A simple chaching mechanism to reduce the number of calls made to the Picasa service.
This is an easy way to cache into flat files the XML feed returned by Picasa for many API calls. This class uses the Singleton pattern so that caching can be turned on once for the client's entire application.
Located in /Picasa/Cache.php (line 18)
Default number of seconds a file will remain cached before it is refreshed.
The value out of the box is 7200 (2 hours). If you do not want to set it manually in your client application, feel free to change it here.
Default location on your server's file system that cache files are stored.
Actually, this location is appended to PHP's include path. This is done by default so a location is chosen that PHP definitely has access to. You can change this is the class's constructor. It is highly recommended that you change this to whatever you want it to be if you do not want the out of the box value because it is risky to change it within your client code.
This path must be readable and writeable by php or caching will be disabled automatically.
The caching instance, used for the Singleton pattern.
The number of seconds after any file is cached that it should be refreshed. If a cache key is accessed this number of seconds after it is initially set, the caching mechanism behaves as though it is not cached.
The absolute path to store the cache files. PHP must have write access to this path or caching will be turned off.
Flag to determine whether or not to cache files.
Public method to get a Cache instance. This is to ensure that only one instance is ever created.
Constructs a Cache object. Declared as private for Singleton pattern so there is only one instance.
Gets the contents at the specified cache key. It will throw an error if the key is not in the cache. It will also return the contents if the cache key has expired. The existence and validity of the key needs to be checked before calling this.
Clears the cache. If a path is supplied, just clears the key mapping to that path. Otherwise, clears the entire cache.
Checks the mere existance (not expiration) of a cache key.
Converts the URL to the feed to cache into a cache key.
Gets the requested feed from the cache if it exists. If it doesn't, returns false.
Checks if the feed passed in is already cached.
Just checks the value of the enabled flag. Could be true or false.
Checks if a cache key has expired.
Sets the flag that determines whether or not to cache.
Caches the contents of a file.
Documentation generated on Tue, 02 Jun 2009 14:51:50 -0700 by phpDocumentor 1.4.1