Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • None
  • PHP

Classes

  • DevNullStorage
  • FileJournal
  • FileStorage
  • MemcachedStorage
  • MemoryStorage
  • PhpFileStorage

Interfaces

  • IJournal
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004, 2011 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  */
11: 
12: namespace Nette\Caching\Storages;
13: 
14: use Nette;
15: 
16: 
17: 
18: /**
19:  * Memory cache storage.
20:  *
21:  * @author     David Grudl
22:  */
23: class MemoryStorage extends Nette\Object implements Nette\Caching\IStorage
24: {
25:     /** @var array */
26:     private $data = array();
27: 
28: 
29: 
30:     /**
31:      * Read from cache.
32:      * @param  string key
33:      * @return mixed|NULL
34:      */
35:     public function read($key)
36:     {
37:         return isset($this->data[$key]) ? $this->data[$key] : NULL;
38:     }
39: 
40: 
41: 
42:     /**
43:      * Writes item into the cache.
44:      * @param  string key
45:      * @param  mixed  data
46:      * @param  array  dependencies
47:      * @return void
48:      */
49:     public function write($key, $data, array $dp)
50:     {
51:         $this->data[$key] = $data;
52:     }
53: 
54: 
55: 
56:     /**
57:      * Removes item from the cache.
58:      * @param  string key
59:      * @return void
60:      */
61:     public function remove($key)
62:     {
63:         unset($this->data[$key]);
64:     }
65: 
66: 
67: 
68:     /**
69:      * Removes items from the cache by conditions & garbage collector.
70:      * @param  array  conditions
71:      * @return void
72:      */
73:     public function clean(array $conds)
74:     {
75:         if (!empty($conds[Nette\Caching\Cache::ALL])) {
76:             $this->data = array();
77:         }
78:     }
79: 
80: }
81: 
Nette Framework 2.0beta1 API API documentation generated by ApiGen 2.3.0