Cache – FileStorage without FileJournal with TAGS support – working solution

5 years ago

pakl
Member | 2
+
0
-

Hi,

i've been experiencing lot of problems with filejournal, SQLiteStorage didn't work well for me too (just hangs). Some errors are probably caused by nginx+php-fpm combination.. Next step would be usage of Kdyby's Redis caching connector… But why install another database, when file cache is good enough?

So, I looked into FileJournal/FileStorage and I decided, to use different approach to TAGS handling…

TAGS are written to meta informations within cache item, nowhere else.

When deleting TAG, i'll save only information about timestamp of this action – to another cache item (tag_deleted_TAGNAME).

When reading original cache item, i'll check every meta TAG, if there is no invalidation since item were saved (so invalidation like EXPIRE etc.).

It's very simple, so I think, it's not good idea. But why? There are serval problems:

  • no garbage collection (writeable, but I don't care about it)
  • no support for PRIORITY – but it's writeable same way! (I just didn't need it)
  • implementation is not Nette nice (it's not nice at all, I'm ugly too, so what!)

If you want to use it (or try, when experiencing FileJournal undefined indexes, segmentation faults, node size is bigger… etc.), just download file bellow.

No warranty, no promises. Just think, this is useable (for me it is).

Feel free, to do anything with this: www.zobak.cz/…oJournal.zip