18
18
//
19
19
// $Id$
20
20
21
- require_once " Cache/Error.php " ;
21
+ require_once ' Cache/Error.php ' ;
22
22
23
23
/**
24
24
* Cache is a base class for cache implementations.
39
39
*
40
40
* Usage example of the generic data cache:
41
41
*
42
- * require_once(" Cache.php" );
42
+ * require_once(' Cache.php' );
43
43
*
44
- * $cache = new Cache(" file" , array(" cache_dir" => " cache/" ) );
45
- * $id = $cache->generateID(" testentry" );
44
+ * $cache = new Cache(' file' , array(' cache_dir' => ' cache/' ) );
45
+ * $id = $cache->generateID(' testentry' );
46
46
*
47
47
* if ($data = $cache->get($id)) {
48
48
* print "Cache hit.<br>Data: $data";
49
49
*
50
50
* } else {
51
- * $data = " data of any kind" ;
51
+ * $data = ' data of any kind' ;
52
52
* $cache->save($id, $data);
53
- * print " Cache miss.<br>" ;
53
+ * print ' Cache miss.<br>' ;
54
54
* }
55
55
*
56
56
* WARNING: No File/DB-Table-Row locking is implemented yet,
@@ -124,7 +124,7 @@ class Cache extends PEAR {
124
124
* @param string Name of storage container class
125
125
* @param array Array with storage class dependend config options
126
126
*/
127
- function Cache ($ storage_driver , $ storage_options = "" )
127
+ function Cache ($ storage_driver , $ storage_options = '' )
128
128
{
129
129
$ this ->PEAR ();
130
130
$ storage_driver = strtolower ($ storage_driver );
@@ -171,9 +171,9 @@ function setCaching($state)
171
171
* @return mixed cached data or NULL on failure
172
172
* @access public
173
173
*/
174
- function get ($ id , $ group = " default " ) {
174
+ function get ($ id , $ group = ' default ' ) {
175
175
if (!$ this ->caching )
176
- return "" ;
176
+ return '' ;
177
177
178
178
if ($ this ->isCached ($ id , $ group ) && !$ this ->isExpired ($ id , $ group ))
179
179
return $ this ->load ($ id , $ group );
@@ -191,11 +191,11 @@ function get($id, $group = "default") {
191
191
* @return boolean
192
192
* @access public
193
193
*/
194
- function save ($ id , $ data , $ expires = 0 , $ group = " default " ) {
194
+ function save ($ id , $ data , $ expires = 0 , $ group = ' default ' ) {
195
195
if (!$ this ->caching )
196
196
return true ;
197
197
198
- return $ this ->extSave ($ id , $ data , "" ,$ expires , $ group );
198
+ return $ this ->extSave ($ id , $ data , '' ,$ expires , $ group );
199
199
} // end func save
200
200
201
201
/**
@@ -211,7 +211,7 @@ function save($id, $data, $expires = 0, $group = "default") {
211
211
* @access public
212
212
* @see getUserdata()
213
213
*/
214
- function extSave ($ id , $ cachedata , $ userdata , $ expires = 0 , $ group = " default " ) {
214
+ function extSave ($ id , $ cachedata , $ userdata , $ expires = 0 , $ group = ' default ' ) {
215
215
if (!$ this ->caching )
216
216
return true ;
217
217
@@ -226,9 +226,9 @@ function extSave($id, $cachedata, $userdata, $expires = 0, $group = "default") {
226
226
* @return mixed cached data or NULL on failure
227
227
* @access public
228
228
*/
229
- function load ($ id , $ group = " default " ) {
229
+ function load ($ id , $ group = ' default ' ) {
230
230
if (!$ this ->caching )
231
- return "" ;
231
+ return '' ;
232
232
233
233
return $ this ->container ->load ($ id , $ group );
234
234
} // end func load
@@ -242,9 +242,9 @@ function load($id, $group = "default") {
242
242
* @access public
243
243
* @see extSave()
244
244
*/
245
- function getUserdata ($ id , $ group = " default " ) {
245
+ function getUserdata ($ id , $ group = ' default ' ) {
246
246
if (!$ this ->caching )
247
- return "" ;
247
+ return '' ;
248
248
249
249
return $ this ->container ->getUserdata ($ id , $ group );
250
250
} // end func getUserdata
@@ -257,7 +257,7 @@ function getUserdata($id, $group = "default") {
257
257
* @return boolean
258
258
* @access public
259
259
*/
260
- function delete ($ id , $ group = " default " ) {
260
+ function delete ($ id , $ group = ' default ' ) {
261
261
if (!$ this ->caching )
262
262
return true ;
263
263
@@ -270,7 +270,7 @@ function delete($id, $group = "default") {
270
270
* @param string cache group, if empty all groups will be flashed
271
271
* @return integer number of removed datasets
272
272
*/
273
- function flush ($ group = "" ) {
273
+ function flush ($ group = '' ) {
274
274
if (!$ this ->caching )
275
275
return true ;
276
276
@@ -287,7 +287,7 @@ function flush($group = "") {
287
287
* @return boolean
288
288
* @access public
289
289
*/
290
- function isCached ($ id , $ group = " default " ) {
290
+ function isCached ($ id , $ group = ' default ' ) {
291
291
if (!$ this ->caching )
292
292
return false ;
293
293
@@ -308,7 +308,7 @@ function isCached($id, $group = "default") {
308
308
* @return boolean
309
309
* @access public
310
310
*/
311
- function isExpired ($ id , $ group = " default " , $ max_age = 0 ) {
311
+ function isExpired ($ id , $ group = ' default ' , $ max_age = 0 ) {
312
312
if (!$ this ->caching )
313
313
return true ;
314
314
0 commit comments