Author: bhofmann
Date: Thu Aug 19 13:18:09 2010
New Revision: 987156

URL: http://svn.apache.org/viewvc?rev=987156&view=rev
Log:
Small enhancements in PHP caching layer

APC: layer tries to fetch apc key before trying to store something in there to 
avoid potential cach slam warnings (see 
http://pecl.php.net/bugs/bug.php?id=16814)

Memcache: made one variable protected so that class can be overriden

Modified:
    shindig/trunk/php/src/common/sample/CacheStorageApc.php
    shindig/trunk/php/src/common/sample/CacheStorageMemcache.php

Modified: shindig/trunk/php/src/common/sample/CacheStorageApc.php
URL: 
http://svn.apache.org/viewvc/shindig/trunk/php/src/common/sample/CacheStorageApc.php?rev=987156&r1=987155&r2=987156&view=diff
==============================================================================
--- shindig/trunk/php/src/common/sample/CacheStorageApc.php (original)
+++ shindig/trunk/php/src/common/sample/CacheStorageApc.php Thu Aug 19 13:18:09 
2010
@@ -26,7 +26,9 @@ class CacheStorageApc extends CacheStora
   }
 
   public function store($key, $value) {
-    return @apc_store($this->storageKey($key), $value);
+    if (($ret = @apc_fetch($key)) === false) {
+      return @apc_store($this->storageKey($key), $value);
+    }
   }
 
   public function fetch($key) {

Modified: shindig/trunk/php/src/common/sample/CacheStorageMemcache.php
URL: 
http://svn.apache.org/viewvc/shindig/trunk/php/src/common/sample/CacheStorageMemcache.php?rev=987156&r1=987155&r2=987156&view=diff
==============================================================================
--- shindig/trunk/php/src/common/sample/CacheStorageMemcache.php (original)
+++ shindig/trunk/php/src/common/sample/CacheStorageMemcache.php Thu Aug 19 
13:18:09 2010
@@ -22,7 +22,7 @@ class CacheStorageMemcache extends Cache
   /**
    * @var Memcache
    */
-  private static $memcache = null;
+  protected static $memcache = null;
 
   private $prefix = null;
 


Reply via email to