aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggHMACCache.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-28 19:17:36 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-28 19:17:36 +0000
commit7ddd9521b3f3a397da3b0a6b56238d31414eb4be (patch)
tree6eb6a9a51db5fa0f5d3cc2ec6de29b9e258b12a1 /engine/classes/ElggHMACCache.php
parentbd3484417d170e62bc94e9db81d4ad37e8ddee6a (diff)
downloadelgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.gz
elgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.bz2
Standardized code in all of core, not including language files, tests, or core mods.
git-svn-id: http://code.elgg.org/elgg/trunk@7124 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggHMACCache.php')
-rw-r--r--engine/classes/ElggHMACCache.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/engine/classes/ElggHMACCache.php b/engine/classes/ElggHMACCache.php
index 551e798f5..8d994d013 100644
--- a/engine/classes/ElggHMACCache.php
+++ b/engine/classes/ElggHMACCache.php
@@ -3,8 +3,8 @@
* ElggHMACCache
* Store cached data in a temporary database, only used by the HMAC stuff.
*
- * @package Elgg
- * @subpackage API
+ * @package Elgg.Core
+ * @subpackage HMAC
*/
class ElggHMACCache extends ElggCache {
/**
@@ -13,14 +13,15 @@ class ElggHMACCache extends ElggCache {
* @param int $max_age Maximum age in seconds, 0 if no limit.
*/
function __construct($max_age = 0) {
- $this->set_variable("max_age", $max_age);
+ $this->setVariable("max_age", $max_age);
}
/**
* Save a key
*
- * @param string $key
- * @param string $data
+ * @param string $key Name
+ * @param string $data Value
+ *
* @return boolean
*/
public function save($key, $data) {
@@ -29,15 +30,17 @@ class ElggHMACCache extends ElggCache {
$key = sanitise_string($key);
$time = time();
- return insert_data("INSERT into {$CONFIG->dbprefix}hmac_cache (hmac, ts) VALUES ('$key', '$time')");
+ $query = "INSERT into {$CONFIG->dbprefix}hmac_cache (hmac, ts) VALUES ('$key', '$time')";
+ return insert_data($query);
}
/**
* Load a key
*
- * @param string $key
- * @param int $offset
- * @param int $limit
+ * @param string $key Name
+ * @param int $offset Offset
+ * @param int $limit Limit
+ *
* @return string
*/
public function load($key, $offset = 0, $limit = null) {
@@ -56,7 +59,8 @@ class ElggHMACCache extends ElggCache {
/**
* Invalidate a given key.
*
- * @param string $key
+ * @param string $key Name
+ *
* @return bool
*/
public function delete($key) {
@@ -71,6 +75,8 @@ class ElggHMACCache extends ElggCache {
* Clear out all the contents of the cache.
*
* Not currently implemented in this cache type.
+ *
+ * @return true
*/
public function clear() {
return true;
@@ -84,9 +90,9 @@ class ElggHMACCache extends ElggCache {
global $CONFIG;
$time = time();
- $age = (int)$this->get_variable("max_age");
+ $age = (int)$this->getVariable("max_age");
- $expires = $time-$age;
+ $expires = $time - $age;
delete_data("DELETE from {$CONFIG->dbprefix}hmac_cache where ts<$expires");
}