Skip to content

Light, simple and standalone PHP in-file caching class

License

Notifications You must be signed in to change notification settings

flightphp/cache

Repository files navigation

Cache Latest Stable VersionLicense

Light, simple and standalone PHP in-file caching class

Advantages

  • Light, standalone and simple
  • All code in one file - no pointless drivers.
  • Secure - every generated cache file have a php header with die, making direct access impossible even if someone knows the path and your server is not configured properly
  • Well documented and tested
  • Handles concurrency correctly via flock
  • Supports PHP 7.4+
  • Free under a MIT license

Requirements and Installation

You need PHP 7.4+ for usage

Require with composer:

composer require flightphp/cache

Usage

<?phpuseflight\Cache; require_once__DIR__ . "/vendor/autoload.php"; $cache = newCache(); $data = $cache->refreshIfExpired("simple-cache-test", function (){returndate("H:i:s"); // return data to be cached }, 10); // cache for 10 secondsecho"Latest cache save: $data";

Documentation

See the documentation for full documentation.

About

Light, simple and standalone PHP in-file caching class

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages