| @@ 61-67 (lines=7) @@ | ||
| 58 | * @return void |
|
| 59 | */ |
|
| 60 | public function set( $key, $value ) { |
|
| 61 | if ( array_key_exists( $key, $this->cache ) ) { |
|
| 62 | $this->ping( $key ); |
|
| 63 | } elseif ( count( $this->cache ) >= $this->maxCacheKeys ) { |
|
| 64 | reset( $this->cache ); |
|
| 65 | $evictKey = key( $this->cache ); |
|
| 66 | unset( $this->cache[$evictKey] ); |
|
| 67 | } |
|
| 68 | $this->cache[$key] = $value; |
|
| 69 | } |
|
| 70 | ||
| @@ 59-64 (lines=6) @@ | ||
| 56 | public function set( $key, $prop, $value ) { |
|
| 57 | if ( isset( $this->cache[$key] ) ) { |
|
| 58 | $this->ping( $key ); |
|
| 59 | } elseif ( count( $this->cache ) >= $this->maxCacheKeys ) { |
|
| 60 | reset( $this->cache ); |
|
| 61 | $evictKey = key( $this->cache ); |
|
| 62 | unset( $this->cache[$evictKey] ); |
|
| 63 | unset( $this->cacheTimes[$evictKey] ); |
|
| 64 | } |
|
| 65 | $this->cache[$key][$prop] = $value; |
|
| 66 | $this->cacheTimes[$key][$prop] = microtime( true ); |
|
| 67 | } |
|