Submit
Path:
~
/
/
opt
/
psa
/
admin
/
plib
/
modules
/
mfa
/
vendor
/
palepurple
/
rate-limit
/
src
/
Adapter
/
File Content:
Stash.php
<?php namespace PalePurple\RateLimit\Adapter; use PalePurple\RateLimit\Adapter; use Stash\Invalidation; /** * This could be changed to just require something implmenting PSR6 - i.e. require a \Cache\CacheItemPoolInterface - but * Stash seems to require the 'setInvalidationMethod()' to be called on items.... */ class Stash extends Adapter { /** * @var \Stash\Pool */ private $pool; public function __construct(\Stash\Pool $pool) { $this->pool = $pool; } public function get($key) { $item = $this->pool->getItem($key); $item->setInvalidationMethod(Invalidation::OLD); if ($item->isHit()) { return $item->get(); } return (float) 0; } public function set($key, $value, $ttl) { $item = $this->pool->getItem($key); $item->set($value); $item->expiresAfter($ttl); return $item->save(); } public function exists($key) { $item = $this->pool->getItem($key); $item->setInvalidationMethod(Invalidation::OLD); return $item->isHit(); } public function del($key) { return $this->pool->deleteItem($key); } }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
APC.php
520 bytes
0644
APCu.php
512 bytes
0644
Memcached.php
921 bytes
0644
Predis.php
892 bytes
0644
Redis.php
1322 bytes
0644
Stash.php
1208 bytes
0644
N4ST4R_ID | Naxtarrr