Skip to content

Conversation

@fprochazka
Copy link
Contributor

APC opcode caching might be dead, because the zend optimizer plus is now native for 5.5+,
but the APCu is still alive and thriving. And I think It's pretty good storage option for some types of cache. Therefore I propose adding new storage supporting it.

I've copied the tests from memcached and rewritten them for the new storage.


There is a problem - Apcu clears cache depending on TTL only when new request occurs - which means It cannot be easily tested. Any idea how to test it?

Or should I implement "fallback" expiration check that will store when the key should be expired and then expire it manually if neccesary?

@fprochazka fprochazka changed the title ApcuStorage: user cache from APC [WIP] ApcuStorage: user cache from APC Dec 18, 2014
@fprochazka fprochazka force-pushed the feature/apcu branch 4 times, most recently from a454794 to edcd260 Compare December 18, 2014 19:30
@Majkl578
Copy link
Contributor

Nice, but 👎 for adding it to the repository, it's only rarely used.

@fprochazka
Copy link
Contributor Author

I have no problem with creating kdyby/apcu-storage, but I thought it might be usefull here.

@dg
Copy link
Member

dg commented Dec 19, 2014

ApcStorage was is Nette 4 year ago https://github.com/nette/outdated-addons/blob/master/ApcStorage/ApcStorage.php, but was removed due to some problems, but I can't remember…

@fprochazka
Copy link
Contributor Author

@dg so should I solve the issues with testing the storage and it will be accepted, or should I create new kdyby package?

@dg
Copy link
Member

dg commented Dec 19, 2014

I remember that there were really serious problems, but I am unable to google it :-(

@dg
Copy link
Member

dg commented Dec 19, 2014

@fprochazka
Copy link
Contributor Author

Interesting, I will investigate and try to debug it. But from a quick look, I can tell the current APCu does not have this "feature" - we're using it for metadata storage and the string is not in logs for the last month.

snimek obrazovky porizeny 2014-12-19 19 11 58

@fprochazka
Copy link
Contributor Author

In fact, I've also copied this class as is, to our codebase and deployed to production last night and also no problems.

@dg
Copy link
Member

dg commented Dec 20, 2014

Probably it is related to apc.slam_defense and apc.write_lock. When slam defense is configurable, I am 👍 for merge.

@Majkl578
Copy link
Contributor

So are we now going to support every backend only few people use - like Redis, MySQL, NoSQL DBs etc.?

@Majkl578
Copy link
Contributor

@dg: No idea why you are mentioning those two directives. First one only enables/disables slamming (which should be on), it can't configure frequency or something. Second one does not even exist in APCu.

@foxycode
Copy link

I am 👍 for merge

@dg
Copy link
Member

dg commented Jan 10, 2015

It is not possible to merge when tests are failing.

@fprochazka
Copy link
Contributor Author

I have very little time to work on it right now, but I'm planning to finish it. As always, if anybody wants to finish it and has the time, you're welcome to take over.

@dg
Copy link
Member

dg commented Feb 10, 2015

ping @fprochazka

@dg dg force-pushed the master branch 3 times, most recently from 2cf4e97 to 13418b9 Compare June 21, 2015 14:26
@tomasstrejcek
Copy link

@fprochazka @Majkl578 its pretty simple, really

APC/APCu cache is based on HTTP(CLI) requests

What the doc means by the stored variable will be expunged from the cache (on the next request)
(http://us3.php.net/manual/en/function.apcu-store.php)

the cache is going to be expunged when the script is next run, so only solution is to run subprocess or something to get it working

the cache is never gonna expire in long running process - but it shouldnt matter depending on what are you using the cache on

perhaps sth like (i dont like but..):

sleep(3);
$cmd = shell_exec('php loadExpiredKey.php');
Assert::equal($cmd, '1');

loadExpiredKey.php:

$cache = new Cache(new ApcuStorage());
echo $cache->load($key) == null;

@dg dg force-pushed the master branch 2 times, most recently from 54c618b to 62a27d9 Compare May 19, 2016 00:29
@dg dg force-pushed the master branch 2 times, most recently from ec9e432 to e07955b Compare June 14, 2016 14:24
@dg dg force-pushed the master branch 3 times, most recently from 492413c to b0b475e Compare January 9, 2017 20:11
@dg dg force-pushed the master branch 4 times, most recently from 6037e83 to 1fe69cc Compare January 13, 2017 07:34
@dg dg force-pushed the master branch 6 times, most recently from 1655c0f to 7c885a2 Compare January 25, 2017 01:39
@dg dg force-pushed the master branch 3 times, most recently from 29c60cc to 62bf8ec Compare January 29, 2017 20:21
@dg
Copy link
Member

dg commented Jan 29, 2017

ping @fprochazka

@dg dg force-pushed the master branch 2 times, most recently from 92222cb to 077ab41 Compare February 2, 2017 02:16
@dg dg force-pushed the master branch 3 times, most recently from 13f731f to d7b0fb9 Compare July 24, 2017 14:11
@dg dg closed this Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants