pkeyGet() and save() methods for Config

This commit is contained in:
Evan Prodromou 2009-11-07 23:16:59 -05:00
parent dd9fa0e683
commit 408510f527

View File

@ -120,6 +120,35 @@ class Config extends Memcached_DataObject
return $result; return $result;
} }
function &pkeyGet($kv)
{
return Memcached_DataObject::pkeyGet('Config', $kv);
}
static function save($section, $setting, $value)
{
$result = null;
$config = Config::pkeyGet(array('section' => $section,
'setting' => $setting));
if (!empty($config)) {
$orig = clone($config);
$config->value = $value;
$result = $config->update($orig);
} else {
$config = new Config();
$config->section = $section;
$config->setting = $setting;
$config->value = $value;
$result = $config->insert();
}
return $result;
}
function _blowSettingsCache() function _blowSettingsCache()
{ {
$c = self::memcache(); $c = self::memcache();