Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libmemcached support #8

Open
GoogleCodeExporter opened this issue Jun 3, 2015 · 2 comments
Open

libmemcached support #8

GoogleCodeExporter opened this issue Jun 3, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

For people to start using vanilla-mvc on multi-tiered architecture, we
absolutely need libmemcached support. For the API, we should be able to:

1) Attach pools of memcached servers to groups. If we want to store a
certain object on a server pool that only handles sessions, we'd identify
it with a "session" group name. Or if we have a pool that handles just a
messaging portion of our site, we'd call it "messages". And if a developer
doesn't want to split them off into pools, then we have a "global" group
that will be accessed if no groupName is given in ->memcached() [see item
2]. Obviously the group names are developer-defined in a config file
somewhere. 

Example pool array would be:
 $memcached_pool = array(
   "global" => array(
     // list of global servers
   ),

   "messages" => array(
     // list of message servers
   )
 );

2) Ability to cache anything, whether it be manual queries or objects. To
completely do this, we will have to tap into ::find() and ::find_first().
I'm not completely sure how we want to do that just yet. For caching manual
queries, we can call the ->memcached() method in the DBIdbh class before we
run ->execute();  ->memcached() can have 3 arguments:

 * groupName: For segmenting this memcached store call out to a specific
server pool. Default: "global"
 * cacheDirective: This would instruct memcached what to do. 0 would not
cache, and pull directly from the database. 1 will cache if not already
cached, and pull from cache. 2 will pull from the database and recache the
object regardless of the set TTL. Default: 0
 * cacheTTL: This sets the TimeToLive for the stored object. Default: 0

Original issue reported on code.google.com by lorderunion on 27 Aug 2008 at 6:03

@GoogleCodeExporter
Copy link
Author

Models that you want cached could have alternative implementations of ::find and
friends that do caching.  For manually defined Models, they could inherit from 
a new
subclass of Model that has overridden methods.  Might be valuable to allow
ModelCommonCode to be specified, or build up the final inheritance graph of 
Model at
runtime (note that the last line of the dbmodels/3/Model.php) using eval or 
some kind
of introspection (is runkit stable, does anyone really use it, does it make a
difference if that is used rather than eval?) .

Original comment by thwarted...@gmail.com on 27 Aug 2008 at 6:25

@GoogleCodeExporter
Copy link
Author

Hmm alright.

Also, for the implementation should we use a DIY class that uses sockets to 
talk to
the memcached server(s), use the official PECL extension
[http://pecl.php.net/package/memcache], or use this
http://phpca.cytherianage.net/memcached/. 

We used the latter at my previous job without any modifications and it did the 
job
without any problems. The only downside to this one, however, is that it hasn't 
been
updated since 2003.

Personally, I'm leaning towards packing in the client from cytherimage just 
because
I'd rather not have vanilla start to have dependencies on PECL packages.

Original comment by lorderunion on 27 Aug 2008 at 2:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant