None.php
1.88 KB
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
<?php 
namespace Phalcon\Cache\Frontend {
	/**
	 * Phalcon\Cache\Frontend\None
	 *
	 * Discards any kind of frontend data input. This frontend does not have expiration time or any other options
	 *
	 *<code>
	 *
	 *	//Create a None Cache
	 *	$frontCache = new Phalcon\Cache\Frontend\None();
	 *
	 *	// Create the component that will cache "Data" to a "Memcached" backend
	 *	// Memcached connection settings
	 *	$cache = new Phalcon\Cache\Backend\Memcache($frontCache, array(
	 *		"host" => "localhost",
	 *		"port" => "11211"
	 *	));
	 *
	 *	// This Frontend always return the data as it's returned by the backend
	 *	$cacheKey = 'robots_order_id.cache';
	 *	$robots    = $cache->get($cacheKey);
	 *	if ($robots === null) {
	 *
	 *		// This cache doesn't perform any expiration checking, so the data is always expired
	 *		// Make the database call and populate the variable
	 *		$robots = Robots::find(array("order" => "id"));
	 *
	 *		$cache->save($cacheKey, $robots);
	 *	}
	 *
	 *	// Use $robots :)
	 *	foreach ($robots as $robot) {
	 *		echo $robot->name, "\n";
	 *	}
	 *</code>
	 */
	
	class None implements \Phalcon\Cache\FrontendInterface {
		/**
		 * Returns cache lifetime, always one second expiring content
		 *
		 * @return int
		 */
		public function getLifetime(){ }
		/**
		 * Check whether if frontend is buffering output, always false
		 *
		 * @return boolean
		 */
		public function isBuffering(){ }
		/**
		 * Starts output frontend
		 */
		public function start(){ }
		/**
		 * Returns output cached content
		 *
		 * @return string
		 */
		public function getContent(){ }
		/**
		 * Stops output frontend
		 */
		public function stop(){ }
		/**
		 * Prepare data to be stored
		 *
		 * @param mixed $data
		 */
		public function beforeStore($data){ }
		/**
		 * Prepares data to be retrieved to user
		 *
		 * @param mixed $data
		 */
		public function afterRetrieve($data){ }
	}
}