DALMP\Cache class works as a dispatcher for the current Cache classes, following a common interface in order to maintain
compatibility with other DALMP classes.
Object interfaces allow you to create code which specifies which methods a class must implement, without having to define how these methods are handled.
|object:||An CacheInterface instance.|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php require_once 'dalmp.php'; $user = getenv('MYSQL_USER') ?: 'root'; $password = getenv('MYSQL_PASS') ?: ''; $DSN = "utf8://$user:$password".'@localhost/test'; $db = new DALMP\Database($DSN); $cache = new DALMP\Cache(new DALMP\Cache\Memcache()); $db->useCache($cache); $rs = $db->CacheGetOne('SELECT now()'); echo $rs, PHP_EOL;
The Dalmp\Cache has no dependency with the DALMP\Database class, this means that you can use only the Database or the Cache classes with out need to depend on eitherone.
Thanks Navicat for supporting Open Source projects.
A great amount of time has been spent creating, crafting and maintaining this software, please consider donating.
Donating helps ensure continued support, development and availability.
comments powered by Disqus