Blame view

src/vendor/1.2.5/Phalcon/Cache/Frontend/Data.php 2.11 KB
ef60cd4d   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  <?php 
  
  namespace Phalcon\Cache\Frontend {
  
  	/**
  	 * Phalcon\Cache\Frontend\Data
  	 *
  	 * Allows to cache native PHP data in a serialized form
  	 *
  	 *<code>
  	 *
  	 *	// Cache the files for 2 days using a Data frontend
  	 *	$frontCache = new Phalcon\Cache\Frontend\Data(array(
  	 *		"lifetime" => 172800
  	 *	));
  	 *
  	 *	// Create the component that will cache "Data" to a "File" backend
  	 *	// Set the cache file directory - important to keep the "/" at the end of
  	 *	// of the value for the folder
  	 *	$cache = new Phalcon\Cache\Backend\File($frontCache, array(
  	 *		"cacheDir" => "../app/cache/"
  	 *	));
  	 *
  	 *	// Try to get cached records
  	 *	$cacheKey = 'robots_order_id.cache';
  	 *	$robots    = $cache->get($cacheKey);
  	 *	if ($robots === null) {
  	 *
  	 *		// $robots is null due to cache expiration or data does not exist
  	 *		// Make the database call and populate the variable
  	 *		$robots = Robots::find(array("order" => "id"));
  	 *
  	 *		// Store it in the cache
  	 *		$cache->save($cacheKey, $robots);
  	 *	}
  	 *
  	 *	// Use $robots :)
  	 *	foreach ($robots as $robot) {
  	 *		echo $robot->name, "\n";
  	 *	}
  	 *</code>
  	 */
  	
  	class Data implements \Phalcon\Cache\FrontendInterface {
  
  		protected $_frontendOptions;
  
  		/**
  		 * \Phalcon\Cache\Frontend\Data constructor
  		 *
  		 * @param array $frontendOptions
  		 */
  		public function __construct($frontendOptions=null){ }
  
  
  		/**
  		 * Returns cache lifetime
  		 *
  		 * @return int
  		 */
  		public function getLifetime(){ }
  
  
  		/**
  		 * Check whether if frontend is buffering output
  		 *
  		 * @return boolean
  		 */
  		public function isBuffering(){ }
  
  
  		/**
  		 * Starts output frontend. Actually, does nothing
  		 */
  		public function start(){ }
  
  
  		/**
  		 * Returns output cached content
  		 *
  		 * @return string
  		 */
  		public function getContent(){ }
  
  
  		/**
  		 * Stops output frontend
  		 */
  		public function stop(){ }
  
  
  		/**
  		 * Serializes data before storing them
  		 *
  		 * @param mixed $data
  		 * @return string
  		 */
  		public function beforeStore($data){ }
  
  
  		/**
  		 * Unserializes data after retrieval
  		 *
  		 * @param mixed $data
  		 * @return mixed
  		 */
  		public function afterRetrieve($data){ }
  
  	}
  }