Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
php-static-resolver-bundle:
image: pimcore/pimcore:php8.2-debug-dev
image: pimcore/pimcore:php8.4-debug-v4-dev
environment:
PHP_IDE_CONFIG: serverName=localhost
volumes:
Expand Down
75 changes: 75 additions & 0 deletions src/Contract/Lib/Cache/RuntimeCacheResolverContract.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Cache;

use Pimcore\Cache\RuntimeCache;

class RuntimeCacheResolverContract implements RuntimeCacheResolverContractInterface
{
public function load(string $id): mixed
{
return RuntimeCache::load($id);
}

public function save(mixed $data, string $id): void
{
RuntimeCache::save($data, $id);
}

public function isRegistered(string $index): bool
{
return RuntimeCache::isRegistered($index);
}

public function clear(array $keepItems = []): void
{
RuntimeCache::clear($keepItems);
}

/**
* @throws \Exception
*/
public function get(string $index): mixed
{
return RuntimeCache::get($index);
}

public function set(string $index, mixed $value): void
{
RuntimeCache::set($index, $value);
}

public function enable(): void
{
RuntimeCache::enable();
}

public function disable(): void
{
RuntimeCache::disable();
}

public function isEnabled(): bool
{
return RuntimeCache::isEnabled();
}

public function getInstance(): RuntimeCache
{
return RuntimeCache::getInstance();
}
}
45 changes: 45 additions & 0 deletions src/Contract/Lib/Cache/RuntimeCacheResolverContractInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Cache;

use Pimcore\Cache\RuntimeCache;

interface RuntimeCacheResolverContractInterface
{
public function load(string $id): mixed;

public function save(mixed $data, string $id): void;

public function isRegistered(string $index): bool;

public function clear(array $keepItems = []): void;

/**
* @throws \Exception
*/
public function get(string $index): mixed;

public function set(string $index, mixed $value): void;

public function enable(): void;

public function disable(): void;

public function isEnabled(): bool;

public function getInstance(): RuntimeCache;
}
109 changes: 109 additions & 0 deletions src/Contract/Lib/CacheResolverContract.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib;

use DateInterval;
use Pimcore\Cache;

class CacheResolverContract implements CacheResolverContractInterface
{
public function load(string $key): mixed
{
return Cache::load($key);
}

public function remove(string $key): bool
{
return Cache::remove($key);
}

public function clearAll(): bool
{
return Cache::clearAll();
}

public function clearTag(string $tag): bool
{
return Cache::clearTag($tag);
}

public function disable(): void
{
Cache::disable();
}

public function save(
mixed $data,
string $key,
array $tags = [],
DateInterval|int|null $lifetime = null,
int $priority = 0,
bool $force = false
): void {
Cache::save($data, $key, $tags, $lifetime, $priority, $force);
}

public function isEnabled(): bool
{
return Cache::isEnabled();
}

public function enable(): void
{
Cache::enable();
}

public function clearTags(array $tag = []): bool
{
return Cache::clearTags($tag);
}

public function addClearTagOnShutdown(string $tag): void
{
Cache::addClearTagOnShutdown($tag);
}

public function addIgnoredTagOnSave(string $tag): void
{
Cache::addIgnoredTagOnSave($tag);
}

public function removeIgnoredTagOnSave(string $tag): void
{
Cache::removeIgnoredTagOnSave($tag);
}

public function addIgnoredTagOnClear(string $tag): void
{
Cache::addIgnoredTagOnClear($tag);
}

public function removeIgnoredTagOnClear(string $tag): void
{
Cache::removeIgnoredTagOnClear($tag);
}

public function setForceImmediateWrite(bool $force): void
{
Cache::setForceImmediateWrite($force);
}

public function getForceImmediateWrite(): bool
{
return Cache::getForceImmediateWrite();
}
}
61 changes: 61 additions & 0 deletions src/Contract/Lib/CacheResolverContractInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib;

use DateInterval;

interface CacheResolverContractInterface
{
public function load(string $key): mixed;

public function remove(string $key): bool;

public function clearAll(): bool;

public function clearTag(string $tag): bool;

public function disable(): void;

public function save(
mixed $data,
string $key,
array $tags = [],
DateInterval|int|null $lifetime = null,
int $priority = 0,
bool $force = false
): void;

public function isEnabled(): bool;

public function enable(): void;

public function clearTags(array $tag = []): bool;

public function addClearTagOnShutdown(string $tag): void;

public function addIgnoredTagOnSave(string $tag): void;

public function removeIgnoredTagOnSave(string $tag): void;

public function addIgnoredTagOnClear(string $tag): void;

public function removeIgnoredTagOnClear(string $tag): void;

public function setForceImmediateWrite(bool $force): void;

public function getForceImmediateWrite(): bool;
}
40 changes: 40 additions & 0 deletions src/Contract/Lib/ConfigResolverContract.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib;

use Pimcore\Config;

class ConfigResolverContract implements ConfigResolverContractInterface
{
public function getWebsiteConfigValue(
?string $key = null,
mixed $default = null,
?string $language = null
): mixed {
return Config::getWebsiteConfigValue($key, $default, $language);
}

public function getWebsiteConfig(?string $language = null): array
{
return Config::getWebsiteConfig($language);
}

public function getEnvironment(): string
{
return Config::getEnvironment();
}
}
26 changes: 26 additions & 0 deletions src/Contract/Lib/ConfigResolverContractInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib;

interface ConfigResolverContractInterface
{
public function getEnvironment(): string;

public function getWebsiteConfigValue(?string $key = null, mixed $default = null, ?string $language = null): mixed;

public function getWebsiteConfig(?string $language = null): array;
}
Loading
Loading