Znote / ZnoteAAC

Developement repository for the Znote AAC project. A website portal to represent and manage your Open Tibia server.
MIT License
146 stars 127 forks source link

Faster and less problematic caching using APCu #371

Closed Znote closed 3 years ago

Znote commented 4 years ago

APCu caching is waaay faster than our current caching system.

Instead of storing and loading cache into flatfiles (which can be messy if we consider file permissions and stuff in unix), we can store the cache data directly in memory.(/RAM).

We can also store this natively as PHP arrays, so no need to encode/decode data to and from json.

While APC is obsolete, APCu version 5+ supports PHP 7.

slawkens commented 4 years ago

Sure, you are right.

Here some base class, you can start with: https://github.com/slawkens/myaac/blob/master/system/libs/cache_apcu.php

Znote commented 4 years ago

Looks like the cache class can be directly rewritten to support APCu without breaking the usage pattern of our existing cache system, here is a prototype:

https://gist.github.com/Znote/d48bbc11adbe3d3e7a524e4286b5a05f