コード例 #1
0
 public static function hasCachedResponse(LinkedDataApiRequest $request)
 {
     if (!function_exists("memcache_connect")) {
         return false;
     }
     $acceptableTypes = $request->getAcceptTypes();
     $uri = $request->uri;
     foreach ($acceptableTypes as $mimetype) {
         $key = LinkedDataApiCache::cacheKey($uri, $mimetype);
         $mc = memcache_connect(PUELIA_MEMCACHE_HOST, PUELIA_MEMCACHE_PORT);
         $cachedObject = $mc->get($key);
         if ($cachedObject) {
             logDebug("Found a cached response for {$mimetype} under key {$key}");
             return $cachedObject;
         }
         logDebug("No cached response for {$mimetype} under key {$key}");
     }
     logDebug('No suitable cached responses found');
     return false;
 }