0 follower

Final Class Yiisoft\Yii\RateLimiter\Storage\SimpleCacheStorage

InheritanceYiisoft\Yii\RateLimiter\Storage\SimpleCacheStorage
ImplementsYiisoft\Yii\RateLimiter\Storage\StorageInterface

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( \Psr\SimpleCache\CacheInterface $cache )
$cache \Psr\SimpleCache\CacheInterface

                public function __construct(private CacheInterface $cache)
{
}

            
get() public method

public float|null get ( string $key )
$key string

                public function get(string $key): ?float
{
    /** @psalm-suppress MixedAssignment */
    $value = $this->cache->get($key);
    return (is_int($value) || is_float($value)) ? (float) $value : null;
}

            
saveCompareAndSwap() public method

public boolean saveCompareAndSwap ( string $key, float $oldValue, float $newValue, integer $ttl )
$key string
$oldValue float
$newValue float
$ttl integer

                public function saveCompareAndSwap(string $key, float $oldValue, float $newValue, int $ttl): bool
{
    return $this->cache->set($key, $newValue, $ttl);
}

            
saveIfNotExists() public method

public boolean saveIfNotExists ( string $key, float $value, integer $ttl )
$key string
$value float
$ttl integer

                public function saveIfNotExists(string $key, float $value, int $ttl): bool
{
    return $this->cache->set($key, $value, $ttl);
}