PHPackages                             peterpalma/file-cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. peterpalma/file-cache

ActiveLibrary[Caching](/categories/caching)

peterpalma/file-cache
=====================

Stores cache on disk rather than in a database

00PHP

Since Feb 6Pushed 3y agoCompare

[ Source](https://github.com/snooz/fileCache)[ Packagist](https://packagist.org/packages/peterpalma/file-cache)[ RSS](/packages/peterpalma-file-cache/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

FileCache
=========

[](#filecache)

I had to do with a hosting company that just refused to enable memcache/memcached/redis because it wasn't a one-click install option in CPanel. So that's why I wrote this class as the storage drives are fast SSDs.

I'm including both a procedural version and a class version.

Tested on:
----------

[](#tested-on)

PHP 7.3 PHP 7.4 PHP 8.0 PHP 8.1 PHP 8.2

How is this different from memcache/memcached/redis
---------------------------------------------------

[](#how-is-this-different-from-memcachememcachedredis)

The main difference is that this stores the data in json files on the harddrive and when you fetch the data you specify how old the data is that you load rather than how old the data is until it expires when you save it as you do in a memory cache server as this doesn't contain a server software.

Procedural usage
----------------

[](#procedural-usage)

Include the cache.php for the Procedural version such as:

```
