diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-11 15:03:36 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-11 15:03:36 +0000 |
commit | 5153d2839b9747aad7ca620602467f7210e5d298 (patch) | |
tree | 348a231a6f53f0437201e67fd4268c9a4af4154d | |
parent | f251e2040785a7b2f1ee51927d98af217546fc8d (diff) | |
download | elgg-5153d2839b9747aad7ca620602467f7210e5d298.tar.gz elgg-5153d2839b9747aad7ca620602467f7210e5d298.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* ElggCache superclass
git-svn-id: https://code.elgg.org/elgg/trunk@164 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/cache.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/engine/lib/cache.php b/engine/lib/cache.php new file mode 100644 index 000000000..5a426cdee --- /dev/null +++ b/engine/lib/cache.php @@ -0,0 +1,72 @@ +<?php + /** + * Elgg cache + * The API REST endpoint. + * + * @package Elgg + * @subpackage API + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey <marcus@dushka.co.uk> + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + /** + * @class ElggCache The elgg cache superclass. + * This defines the interface for a cache (wherever that cache is stored). + * @author Marcus Povey <marcus@dushka.co.uk> + */ + abstract class ElggCache + { + /** + * Variables for the cache object. + * + * @var array + */ + private $variables; + + /** + * Set the constructor. + */ + function __construct() { $this->variables = array(); } + + /** + * Set a cache variable. + * + * @param string $variable + * @param string $value + */ + public function set_variable($variable, $value) { $this->variables[$variable] = $value; } + + /** + * Get variables for this cache. + * + * @param string $variable + * @return mixed The variable or null; + */ + public function get_variable($variable) + { + if (isset($this->variables[$variable])) + return $this->variables[$variable]; + + return null; + } + + /** + * Save data in a cache. + * + * @param string $key + * @param string $data + * @return bool + */ + abstract public function save($key, $data); + + /** + * Load data from the cache using a given key. + * + * @param string $key + * @return mixed The stored data or false. + */ + abstract public function load($key); + } +?>
\ No newline at end of file |