diff options
author | Simon Rettberg | 2016-08-29 17:12:19 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-08-29 17:12:19 +0200 |
commit | 4065985d01abc45ddd23a28d25afeda164bf2799 (patch) | |
tree | 95258cf30f550268f07cb44faaa0e0733ca45aed | |
parent | [eventlog] Don't die on DB insert error (diff) | |
download | slx-admin-4065985d01abc45ddd23a28d25afeda164bf2799.tar.gz slx-admin-4065985d01abc45ddd23a28d25afeda164bf2799.tar.xz slx-admin-4065985d01abc45ddd23a28d25afeda164bf2799.zip |
[property] Make generic getter and setter public; seems best option for modularization
-rw-r--r-- | inc/property.inc.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/inc/property.inc.php b/inc/property.inc.php index 4a6c3720..9adfbda3 100644 --- a/inc/property.inc.php +++ b/inc/property.inc.php @@ -16,7 +16,7 @@ class Property * @param mixed $default value to return if $key does not exist in the property store * @return mixed the value attached to $key, or $default if $key does not exist */ - private static function get($key, $default = false) + public static function get($key, $default = false) { if (self::$cache === false) { $NOW = time(); @@ -37,16 +37,16 @@ class Property * * @param string $key key of value to set * @param type $value the value to store for $key - * @param int $minage how long to keep this entry around at least, in minutes. 0 for infinite + * @param int $maxAgeMinutes how long to keep this entry around at least, in minutes. 0 for infinite */ - private static function set($key, $value, $minage = 0) + public static function set($key, $value, $maxAgeMinutes = 0) { if (self::$cache === false || self::get($key) != $value) { // Simple compare, so it works for numbers accidentally casted to string somewhere Database::exec("INSERT INTO property (name, value, dateline) VALUES (:key, :value, :dateline)" . " ON DUPLICATE KEY UPDATE value = VALUES(value), dateline = VALUES(dateline)", array( 'key' => $key, 'value' => $value, - 'dateline' => ($minage === 0 ? 0 : time() + ($minage * 60)) + 'dateline' => ($maxAgeMinutes === 0 ? 0 : time() + ($maxAgeMinutes * 60)) )); } if (self::$cache !== false) { |