Friday 24 April 2009 12:42:34 am
I would maybe aim at the beta, so the abstractions include the functions you have there witch can be very valuable ( :append, ::setMulti and ::setMultiByKey among others...). So the abstraction would be like
public function append( $key, $value )
{
if ( $this->mem !== null )
{
$this->mem->append( $key, $value );
return true;
}
return false;
}
So if you need to downgrade because of instability you would hav to do something like:
public function append( $key, $value )
{
if ( $this->mem !== null )
{
$currentValue = $this->mem->get( $key );
if ( $currentValue === false )
$this->mem->set( $key, $value );
else
$this->mem->set( $key, $currentValue . $value );
return true;
}
return false;
}
I suggest a object approach to the abstraction class, perferably with a singleton pattern ( stMemCache::getInstance() -> self::$instance === null -> protected function __construct() -> return self::$instance; ). But it can just as well be done on a all static class, where you call stMemCache::init() first to set self::$mem (instead of $this->mem). Sorry that I can't really answear your first question on what to choose, any one here who have tried Memcached?
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom
|