Neevo Public API
  • Namespace
  • Class
  • Tree

Namespaces

  • Neevo
    • Cache
    • Drivers
    • Nette
  • PHP

Classes

  • CacheAdapter
  • DebugPanel
  • Extension
 1 <?php
 2 /**
 3  * Neevo extension for Nette Framework.
 4  *
 5  * This source file is subject to the MIT license that is bundled
 6  * with this package in the file license.txt.
 7  *
 8  * Copyright (c) 2012 Smasty (http://smasty.net)
 9  *
10  */
11 
12 namespace Neevo\Nette;
13 
14 use Neevo\Cache\StorageInterface;
15 use Nette\Caching\Cache;
16 use Nette\Caching\IStorage;
17 
18 
19 /**
20  * Cache adapter for Nette Framework cache storage system.
21  * @author Smasty
22  */
23 class CacheAdapter implements StorageInterface {
24 
25 
26     /** @var Cache */
27     private $cache;
28 
29 
30     /**
31      * Creates the cache adapter.
32      * @param string $cacheKey Generated from service name
33      * @param IStorage $storage
34      */
35     public function __construct($cacheKey, IStorage $storage){
36         $this->cache = new Cache($storage, $cacheKey);
37     }
38 
39 
40     public function fetch($key){
41         return $this->cache[$key];
42     }
43 
44 
45     public function store($key, $value){
46         $this->cache[$key] = $value;
47     }
48 
49 
50     public function flush(){
51         $this->cache->clean();
52         return true;
53     }
54 
55 
56 }
57 
Neevo Public API API documentation generated by ApiGen 2.8.0