Final Class Yiisoft\Yii\RateLimiter\Storage\SimpleCacheStorage
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Public Methods
Method Details
| public mixed __construct ( \ | ||
| $cache | \ |
|
public function __construct(private CacheInterface $cache) {}
| public ?float 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;
}
| 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);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.