Packages

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

Classes

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

Interfaces

  • ICacheJournal
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004 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:  * @package Nette\Caching\Storages
11:  */
12: 
13: 
14: 
15: /**
16:  * Memory cache storage.
17:  *
18:  * @author     David Grudl
19:  * @package Nette\Caching\Storages
20:  */
21: class MemoryStorage extends Object implements ICacheStorage
22: {
23:     /** @var array */
24:     private $data = array();
25: 
26: 
27:     /**
28:      * Read from cache.
29:      * @param  string key
30:      * @return mixed|NULL
31:      */
32:     public function read($key)
33:     {
34:         return isset($this->data[$key]) ? $this->data[$key] : NULL;
35:     }
36: 
37: 
38:     /**
39:      * Prevents item reading and writing. Lock is released by write() or remove().
40:      * @param  string key
41:      * @return void
42:      */
43:     public function lock($key)
44:     {
45:     }
46: 
47: 
48:     /**
49:      * Writes item into the cache.
50:      * @param  string key
51:      * @param  mixed  data
52:      * @param  array  dependencies
53:      * @return void
54:      */
55:     public function write($key, $data, array $dependencies)
56:     {
57:         $this->data[$key] = $data;
58:     }
59: 
60: 
61:     /**
62:      * Removes item from the cache.
63:      * @param  string key
64:      * @return void
65:      */
66:     public function remove($key)
67:     {
68:         unset($this->data[$key]);
69:     }
70: 
71: 
72:     /**
73:      * Removes items from the cache by conditions & garbage collector.
74:      * @param  array  conditions
75:      * @return void
76:      */
77:     public function clean(array $conditions)
78:     {
79:         if (!empty($conditions[Cache::ALL])) {
80:             $this->data = array();
81:         }
82:     }
83: 
84: }
85: 
Nette Framework 2.0.11 (for PHP 5.2, un-prefixed) API API documentation generated by ApiGen 2.8.0