Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Best practise / advices: Using the cache
  • Hey! I'm looking for help regarding a recent fuelphp project. Basically I have a site where the user can search certain products based on a set of keywords (1-100 keywords, but every keyword is a own request) The results are provided by the amazon product advertising api. The thing is that users will often use the same keywords when they request something. So I think caching those results would be a good idea. Unfortunately I'm a total noob regarding caching with php / the fuel php cache class, so I wanted to ask you what driver you would suggest me to use for this project or if you have any other helpful advices / howtos (especially with usage of fuelphp). Thanks in advance!
    Matthias
  • You need something with auto-expiration, file cache for example doesn't support that. Memcached supports that, Redis as well and APC caching does (you need 1.1 for that though). I'd let searches expire within an hour or so. You'll have to experiment and checkout if it all works, get some statistics from whatever driver you use and see if it does its work (can't help you there but I assume all have those).
  • In case of the file driver, the expiration timestamp is part of the cache file header, so it should be possible to detect the expiration, delete the cache file, and return false. Sounds like a fix for 1.1, so it behaves similar to the other drivers...
  • In case of the file driver, the expiration timestamp is part of the cache file header, so it should be possible to detect the expiration, delete the cache file, and return false.
    That's how it works, with auto-expiration I meant including garbage collection. Files are only deleted when requested after expiration, while the other drivers all have some type of garbage collection that gets rid of the old values not only upon request but also when space is needed.
  • Ok, I already wondered. I added an issue for this: https://github.com/fuel/core/issues/613

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion