mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-09-20 04:34:39 -04:00
implementing key/value store of Persistance in Database storage
This commit is contained in:
parent
7901ec74a7
commit
a203e6322b
8 changed files with 86 additions and 65 deletions
|
@ -28,6 +28,15 @@ abstract class AbstractData
|
|||
*/
|
||||
protected static $_instance = null;
|
||||
|
||||
/**
|
||||
* cache for the traffic limiter
|
||||
*
|
||||
* @access private
|
||||
* @static
|
||||
* @var array
|
||||
*/
|
||||
protected static $_traffic_limiter_cache = array();
|
||||
|
||||
/**
|
||||
* Enforce singleton, disable constructor
|
||||
*
|
||||
|
@ -138,7 +147,16 @@ abstract class AbstractData
|
|||
* @param int $time
|
||||
* @return void
|
||||
*/
|
||||
abstract public function purgeValues($namespace, $time);
|
||||
public function purgeValues($namespace, $time)
|
||||
{
|
||||
if ($namespace === 'traffic_limiter') {
|
||||
foreach (self::$_traffic_limiter_cache as $key => $last_access) {
|
||||
if ($last_access <= $time) {
|
||||
unset(self::$_traffic_limiter_cache[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a value.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue