Skip to content

Commit

Permalink
[Task] Added resolver for TmpStore (#19)
Browse files Browse the repository at this point in the history
* Added resolver for TmpStore

* Added strict_types declaration...
  • Loading branch information
mcop1 authored Oct 20, 2023
1 parent ffaf91d commit ea06150
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/Models/Tool/TmpStoreResolver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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\Models\Tool;

use Pimcore\Model\Tool\TmpStore;

final class TmpStoreResolver implements TmpStoreResolverInterface
{
public function add(string $id, mixed $data, ?string $tag = null, ?int $lifetime = null): bool
{
return TmpStore::add($id, $data, $tag, $lifetime);
}

public function get(string $id): ?TmpStore
{
return TmpStore::get($id);
}

public function delete(string $id): void
{
TmpStore::delete($id);
}

public function getIdsByTag(string $tag): array
{
return TmpStore::getIdsByTag($tag);
}

public function set(string $id, mixed $data, ?string $tag = null, ?int $lifetime = null): bool
{
return TmpStore::set($id, $data, $tag, $lifetime);
}
}
15 changes: 15 additions & 0 deletions src/Models/Tool/TmpStoreResolverInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);

namespace Pimcore\Bundle\StaticResolverBundle\Models\Tool;

use Pimcore\Model\Tool\TmpStore;

interface TmpStoreResolverInterface
{
public function add(string $id, mixed $data, ?string $tag, ?int $lifetime): bool;
public function get(string $id): ?TmpStore;
public function delete(string $id): void;
public function getIdsByTag(string $tag): array;
public function set(string $id, mixed $data, ?string $tag = null, ?int $lifetime = null): bool;
}

0 comments on commit ea06150

Please sign in to comment.