e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 213 forks source link

Cache expiry date #4060

Open nesjett opened 4 years ago

nesjett commented 4 years ago

I see the method e107::getCache()->retrieve() includes a parameter for the max age of the cache, but does this means it only "expires" when you try to access it and it's too old or there is another system that "periodically" checks outdated cache and cleans it?

Related to this, I'm concerned about how it exaclty works in terms of efficiency and storage capacity.

Thank you,

EDIT: To be more precise, I'm concerned about disk usage as I'm planning on using one cache file per news content, and this content will be updated with new content around ~200 times per day, which means a really huge ammount of cache files per week.

EDIT2: I also noticed that the cache system is slower than accessing the DB currently (maybe because the DB is still very small in data) but is this really more performant with huge ammounts of data in both alternatives? Is it really usefull using cache when the DB is hosted in the same server as the core system?

nesjett commented 4 years ago

Actually I dont completly understand the e107 cache utilities. It's true that we can leverage a little bit the database accessess, sometimes, but I don't think its really usefull. Ive been looking into newsfeed plugin use of cache (because it's an official plugin) and It uses cache to store a serialized array of data, which makes a bit of sense, but not at all tho.

Maybe for this system is okay as it handles small ammounts of data, but in this scenerario we dont really need a caching system at all. The problem comes when we have hundreds of thousands of data. Is not a caching system at all as caching usually is related to storing data in the RAM, which is way faster and usually is composed by just a key-value array, and also the current one is not scallable nor ditributed.

I see this caching system as a good interface to avoid DB accessess, but only if the real cache system doesnt have the data. What I mean is some architecture like this:

PAGE REQUEST -> MEMCACHE -> E107 CACHE -> DATABASE

So if the content is not in the first caching system, it goes to the next, and then finally to the database.

Actually I think implementing memcache in the current e107 cache system would be easy as we can use the existing cache functions and simply make them check on memcache first, and if not, continue with the actual behaviour of e107 cache.

So this are my thought after digging a bit into e107 caching system. Any thought, advices or corrections on this would be really appreciated.

Moc commented 2 years ago

Actually I think implementing memcache in the current e107 cache system would be easy as we can use the existing cache functions and simply make them check on memcache first, and if not, continue with the actual behaviour of e107 cache.

This sounds like a good plan. PR's welcome.