jpfuentes2 / php-activerecord

ActiveRecord implementation for PHP
http://www.phpactiverecord.org/
Other
1.32k stars 443 forks source link

Cache configuration refactoring #147

Open greut opened 13 years ago

greut commented 13 years ago

A proposal for a backward compatible Cache configuration mecanism:

<?php
$cfg->set_cache(array(
    'adapter' => 'apc',
));

// default localhost:11211
$cfg->set_cache(array(
    'adapter' => 'memcache',
));

// the very complex one
$cfg->set_cache(array(
    'adapter' => 'memcached',
    'servers' => array(
        'localhost:11211',
        'localhost:11212' => 2, // more weight, default 1
    ),
    'options' => array(
        Memcached::OPT_LIBKETAMA_COMPATIBLE => true,
    ),
    'namespace' => 'foo',
    'expire' => 0, // default
));

the discussion started there: https://github.com/Fuitad/php-activerecord/commit/b9280aaabf8d594d0a307d684d8c305c7fd1674f

greut commented 13 years ago

A first effort: https://github.com/greut/php-activerecord/compare/gh147-cache-configuration

greut commented 13 years ago

A better one (Memcached and APC): https://github.com/greut/php-activerecord/compare/gh147-gh137-cache