1 | <?php |
||
34 | class Memcached extends Adapter |
||
35 | { |
||
36 | /** |
||
37 | * Memcached adapter |
||
38 | * |
||
39 | * @var MemcachedAdapterInterface |
||
40 | **/ |
||
41 | private $memcached; |
||
42 | |||
43 | /** |
||
44 | * Constructor |
||
45 | * |
||
46 | * @param mixed $persistentId By default the Memcached instances are destroyed at the end of the request. |
||
47 | * To create an instance that persists between requests, use $persistentId to |
||
48 | * specify a unique ID for the instance. All instances created with the same |
||
49 | * $persistentId will share the same connection. |
||
50 | * @return void |
||
|
|||
51 | **/ |
||
52 | public function __construct($persistentId = null) |
||
59 | |||
60 | /** |
||
61 | * Get the memcached adapter |
||
62 | * |
||
63 | * @return MemcachedAdapterInterface |
||
64 | */ |
||
65 | public function getMemcached() |
||
69 | |||
70 | /** |
||
71 | * Set the memcached adapter |
||
72 | * |
||
73 | * @param MemcachedAdapterInterface $memcached |
||
74 | * @return Memcached |
||
75 | */ |
||
76 | public function setMemcached(MemcachedAdapterInterface $memcached) |
||
82 | |||
83 | /** |
||
84 | * Add a server |
||
85 | * |
||
86 | * @param string $host |
||
87 | * @param int $port |
||
88 | * @param int $weight |
||
89 | * @return Memcached |
||
90 | **/ |
||
91 | public function addServer($host, $port, $weight = 0) |
||
97 | |||
98 | /** |
||
99 | * Save some data |
||
100 | * |
||
101 | * @param string $data |
||
102 | * @param string $id |
||
103 | * @param int $lifeTime lifetime in seconds |
||
104 | * @return bool |
||
105 | **/ |
||
106 | public function save($data, $id, $lifeTime) |
||
110 | |||
111 | /** |
||
112 | * Load an item from the cache |
||
113 | * |
||
114 | * @param string $id |
||
115 | * @return mixed|ResultNotFound |
||
116 | **/ |
||
117 | public function load($id) |
||
127 | |||
128 | /** |
||
129 | * Delete an item from the cache |
||
130 | * |
||
131 | * @param string $id |
||
132 | * @return bool |
||
133 | **/ |
||
134 | public function delete($id) |
||
138 | } |
||
139 | |||
140 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.