This is a PHP class to store and cache data as a file. You can use this
class without any additonal service on any hoster. It does not require
any library, framework or database.
I wrote it to cache data for the website of Swiss public radio (DRS/ SRF) where it was in use for several years.
You can store any data you can handle with the serialize function: integers, strings/ texts, arrays, objects. In other words: 99.9% of all data you can fetch from internet services or database resultsets.
If it is called a cache you need to know, when it is outdated an when you must refresh your cached data.
You can put a TTL (in sec) to your data. Or you can compare the cache with another local file.
Additionally you have methods to see the age of your cache, is it outdated already or not.
If you create data you must be able to cleanup them. This class offers to delete a single cache item, all cached items of an application or all cached items of all applications
You can use this class nearly anywhere on each hoster in the world. The requirements are the most simple you can imagine: