From 4065985d01abc45ddd23a28d25afeda164bf2799 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 29 Aug 2016 17:12:19 +0200 Subject: [property] Make generic getter and setter public; seems best option for modularization --- inc/property.inc.php | 8 ++++---- 1 file 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) { -- cgit v1.2.3-55-g7522