/** * Flush one file * * @param string|string[] $filename */ public function flush($filename) { if (is_array($filename)) { foreach ($filename as $file) { $this->flush($file); } } else { $this->cache->delete(md5($filename)); } }
// Attempt to retrieve previously cached result from pool (run this twice) if (!$cache->get(KEY, $resource)) { print "Key was not found in our cache pool!\n"; // Create test resource $resource = new stdClass(); $resource->name = 'Test'; // If nothing was found during our cache look up, save resource to cache pool if ($cache->set(KEY, $resource)) { print "Stored resource in cache pool!\n"; } else { print "Failed to store resource in cache pool!\n"; } } else { print "Key was found in our cache pool!\n"; // Let's get fancy $server = $cache->getServerByKey(KEY); if ($server) { print "Server key is mapped to: " . print_r($server) . "\n"; } // We retrieved resource from cache, let's make sure delete works if ($cache->delete(KEY)) { print "Deleted resource from cache!\n"; } else { print "Failed to delete resource from cache!\n"; } } print "Resource: \n"; print_r($resource); } catch (Exception $exception) { print $exception->getMessage(); }