apix / cache Goto Github PK
View Code? Open in Web Editor NEWA thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache tagging and indexing.
License: Other
A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache tagging and indexing.
License: Other
Memcached for PHP 7.0 does not currently work with Travis build.
See: https://travis-ci.org/frqnck/apix-cache/jobs/142451500
Affects:
PHP Version: 7.0
Extension: memcached
Hello,
I am looking at an issue when creating a pool using a factory, if I set the 'prefix_key' and 'prefix_tag' options they are overriden with hardcoded values: 'apix-key-' and 'apix-tag-'.
Apparently this happens in the constructors of TaggablePool and Pool. I would suggest to pass maybe just the 'taggable' boolean attribute to the adapters, and maybe not include the prefixes :)
Regards,
Alex
Memcached for PHP 5.3 no longer working with Travis build.
See: https://travis-ci.org/frqnck/apix-cache/jobs/142451472
Affects:
Uncaught Apix\Cache\PsrCache\InvalidArgumentException: Item key ('test:string') is invalid
use Apix\Cache;
$backend = new \Redis();
$backend->connect('localhost');
$backend->select(1);
$cache = Cache\Factory::getPool($backend);
$item = $cache->getItem('test:string');
returns:
PHP Fatal error: Uncaught Apix\Cache\PsrCache\InvalidArgumentException: Item key ('test:string') is invalid. in
./vendor/apix/cache/src/PsrCache/Item.php:71
Stack trace:
#0 /vendor/apix/cache/src/PsrCache/Pool.php(53): Apix\Cache\PsrCache\Item::normalizedKey()
#1 /test_redis_apix.php(17): Apix\Cache\PsrCache\Pool->getItem()
#2 {main}
thrown in /vendor/apix/cache/src/PsrCache/Item.php on line 71
But Redis allowed use this key:
root@quartz:/etc/redis# redis-cli --version
redis-cli 6.2.6
root@quartz:/etc/redis# redis-cli
127.0.0.1:6379> set test:string 'foobar'
OK
127.0.0.1:6379> get test:string
"foobar"
127.0.0.1:6379>
Also, keys with :
recommended by official documentation: https://redis.io/topics/data-types-intro#redis-keys
Very short keys are often not a good idea. There is little point in writing "u1000flw" as a key if you can instead write "user:1000:followers". The latter is more readable and the added space is minor compared to the space used by the key object itself and the value object. While short keys will obviously consume a bit less memory, your job is to find the right balance.
Travis-CI builds are currently run on Xenial which doesn't support PHP 5.4 and 5.5.
From Redis Documentation:
Warning: consider KEYS as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This command is intended for debugging and special operations, such as changing your keyspace layout. Don't use KEYS in your regular application code. If you're looking for a way to find keys in a subset of your keyspace, consider using SCAN or sets.
The Redis module probably shouldn't be using the keys command - could probably be replaced with a private function that runs a scan on a pattern and compiles those lists.
Feature Proposal
Add PHP 7.4 to the Travis build and make any code changes necessary to run on PHP 7.4 (while continuing to support currently supported versions of PHP)
Since APC as a caching engine is no longer supported, please add support for APCu. This could be as simple as cloning your APC class and renaming the methods to apcu_*
Do you have thoughts about adding a standard "increment" function for the AbstractCache.php in apix-cache? I know that both Redis and Memcached have this function, and its something I need at the moment -- using ->getAdapter()->... Instead.
Jonathan
Adding increment/decrement methods to AbstractCache.php would be useful indeed.
It would be good to have a base/inhertied implementations generic enough so that backends without dedicated functions would still benefit.
PDO, Runtime and Filesystem(s) donβt have dedicated (in|de)crementors β the rest do.
Essentially, a base implementations would be a two steps affair, i.e. retrieve and update/upsert a (numerical) value. The default (in|de)cremental value being 1.
mongodb
extension for HHVM does not currently work with Travis build.
See: https://travis-ci.org/frqnck/apix-cache/jobs/171382299
Affects:
HHVM Version: 3.6.6
Extension: mongodb
Hello,
Apparently the 'Files' and 'Directory' clients are not listed in the Factory, thus we cannot instantiate a factory by passing a string like 'files' or 'directory'. Also, the first argument in the implementation of those 2 classes should be an instance of the class itself, otherwise the factory will throw an error.
Maybe I missed something?!
Thanks,
Regards,
Alex
Hello,
Whenever I try to read a cache file generated through Files on Windows, I get a miss with the following PHP notice:
PHP Notice: unserialize(): Error at offset 0 of 3224505 bytes in D:....\vendor\apix\cache\src\Files.php on line 70
I realized that Files::loadKey relies on the assumption that PHP_EOL (used for adding key and expiration to the cache entry) is of size 1, which is not the case on Windows (\r\n).
Just to check that it was indeed the issue, I changed 2 lines in Files::loadKey to have:
$pos+strlen(PHP_EOL)
instead of:
$pos+1
and the unserialize function returned correctly this time.
I'm not sure this is the only occurence of the issue.
Could it be possible to have a fix for this?
Best regards,
Davy
The implementation of the AbstractPdo classes drops the cache table on flush(true). This results on a exception being thrown if the cache is subsequently accessed as the cache table no longer exists.
Additionally the implementation does not match the documentation for the method provided by Adapter::flush().
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.