| @@ 26-62 (lines=37) @@ | ||
| 23 | * THE SOFTWARE. |
|
| 24 | */ |
|
| 25 | ||
| 26 | class Apc extends AbstractEnhancedProvider { |
|
| 27 | ||
| 28 | public function __construct(array $properties = [], LoggerInterface $logger = null) { |
|
| 29 | ||
| 30 | try { |
|
| 31 | ||
| 32 | parent::__construct($properties, $logger); |
|
| 33 | ||
| 34 | $this->driver = new ApcDriver(); |
|
| 35 | ||
| 36 | $this->test(); |
|
| 37 | ||
| 38 | } catch (Exception $e) { |
|
| 39 | ||
| 40 | throw new CacheException($e->getMessage()); |
|
| 41 | ||
| 42 | } |
|
| 43 | ||
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function getStats() { |
|
| 50 | ||
| 51 | $info = $this->driver->stats(); |
|
| 52 | ||
| 53 | $entries = isset($info['num_entries']) ? $info['num_entries'] : null; |
|
| 54 | ||
| 55 | return new EnhancedCacheItemPoolStats( |
|
| 56 | $this->getId(), |
|
| 57 | $this->driver->getName(), |
|
| 58 | $this->getState(), |
|
| 59 | $entries, |
|
| 60 | $info |
|
| 61 | ); |
|
| 62 | ||
| 63 | } |
|
| 64 | ||
| 65 | } |
|
| @@ 26-56 (lines=31) @@ | ||
| 23 | * THE SOFTWARE. |
|
| 24 | */ |
|
| 25 | ||
| 26 | class Apcu extends AbstractEnhancedProvider { |
|
| 27 | ||
| 28 | public function __construct(array $properties = [], LoggerInterface $logger = null) { |
|
| 29 | ||
| 30 | try { |
|
| 31 | ||
| 32 | parent::__construct($properties, $logger); |
|
| 33 | ||
| 34 | $this->driver = new ApcuDriver(); |
|
| 35 | ||
| 36 | $this->test(); |
|
| 37 | ||
| 38 | } catch (Exception $e) { |
|
| 39 | ||
| 40 | throw new CacheException($e->getMessage()); |
|
| 41 | ||
| 42 | } |
|
| 43 | ||
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function getStats() { |
|
| 50 | ||
| 51 | $info = $this->driver->stats(); |
|
| 52 | ||
| 53 | $entries = isset($info['num_entries']) ? $info['num_entries'] : null; |
|
| 54 | ||
| 55 | return new EnhancedCacheItemPoolStats($this->getId(), $this->driver->getName(), $this->getState(), $entries, $info); |
|
| 56 | ||
| 57 | } |
|
| 58 | ||
| 59 | } |
|
| @@ 25-61 (lines=37) @@ | ||
| 22 | * THE SOFTWARE. |
|
| 23 | */ |
|
| 24 | ||
| 25 | class Apc extends AbstractEnhancedProvider { |
|
| 26 | ||
| 27 | public function __construct(array $properties = [], LoggerInterface $logger = null) { |
|
| 28 | ||
| 29 | try { |
|
| 30 | ||
| 31 | parent::__construct($properties, $logger); |
|
| 32 | ||
| 33 | $this->driver = new ApcDriver(); |
|
| 34 | ||
| 35 | $this->test(); |
|
| 36 | ||
| 37 | } catch (Exception $e) { |
|
| 38 | ||
| 39 | throw new SimpleCacheException($e->getMessage()); |
|
| 40 | ||
| 41 | } |
|
| 42 | ||
| 43 | } |
|
| 44 | ||
| 45 | public function getStats() { |
|
| 46 | ||
| 47 | $info = $this->driver->stats(); |
|
| 48 | ||
| 49 | $entries = isset($info['num_entries']) ? $info['num_entries'] : null; |
|
| 50 | ||
| 51 | return new EnhancedCacheItemPoolStats( |
|
| 52 | $this->getId(), |
|
| 53 | $this->driver->getName(), |
|
| 54 | $this->getState(), |
|
| 55 | $entries, |
|
| 56 | $info |
|
| 57 | ); |
|
| 58 | ||
| 59 | } |
|
| 60 | ||
| 61 | } |
|
| 62 | ||
| @@ 25-61 (lines=37) @@ | ||
| 22 | * THE SOFTWARE. |
|
| 23 | */ |
|
| 24 | ||
| 25 | class Apcu extends AbstractEnhancedProvider { |
|
| 26 | ||
| 27 | public function __construct(array $properties = [], LoggerInterface $logger = null) { |
|
| 28 | ||
| 29 | try { |
|
| 30 | ||
| 31 | parent::__construct($properties, $logger); |
|
| 32 | ||
| 33 | $this->driver = new ApcuDriver(); |
|
| 34 | ||
| 35 | $this->test(); |
|
| 36 | ||
| 37 | } catch (Exception $e) { |
|
| 38 | ||
| 39 | throw new SimpleCacheException($e->getMessage()); |
|
| 40 | ||
| 41 | } |
|
| 42 | ||
| 43 | } |
|
| 44 | ||
| 45 | public function getStats() { |
|
| 46 | ||
| 47 | $info = $this->driver->stats(); |
|
| 48 | ||
| 49 | $entries = isset($info['num_entries']) ? $info['num_entries'] : null; |
|
| 50 | ||
| 51 | return new EnhancedCacheItemPoolStats( |
|
| 52 | $this->getId(), |
|
| 53 | $this->driver->getName(), |
|
| 54 | $this->getState(), |
|
| 55 | $entries, |
|
| 56 | $info |
|
| 57 | ); |
|
| 58 | ||
| 59 | } |
|
| 60 | ||
| 61 | } |
|
| 62 | ||