PHPackages                             jdorn/file-system-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. jdorn/file-system-cache

ActiveLibrary[Caching](/categories/caching)

jdorn/file-system-cache
=======================

an easy way to cache data in the file system

5646.1k↓37%12[1 issues](https://github.com/jdorn/FileSystemCache/issues)[1 PRs](https://github.com/jdorn/FileSystemCache/pulls)PHP

Since Jul 5Pushed 12y ago8 watchersCompare

[ Source](https://github.com/jdorn/FileSystemCache)[ Packagist](https://packagist.org/packages/jdorn/file-system-cache)[ RSS](/packages/jdorn-file-system-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

FileSystemCache
===============

[](#filesystemcache)

A simple PHP class for caching data in the filesystem. Major features include:

- Support for TTL when storing data
- Support for "Newer Than" parameter when retrieving data
- Every call is an atomic operation with proper file locking
- Can group cache keys together for easy invalidation
- Composer support
- PHPUnit tests

[![Build Status](https://camo.githubusercontent.com/52d26a1cc10051f84695c63e2b9973f168683ec2bf1567a90e9a28b5c298b95d/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6a646f726e2f46696c6553797374656d43616368652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/jdorn/FileSystemCache)

Getting Started
---------------

[](#getting-started)

FileSystemCache can be installed with Composer or downloaded manually.

### With Composer

[](#with-composer)

If you're already using Composer, just add `jdorn/file-system-cache` to your `composer.json` file. FileSystemCache works with Composer's autoloader out of the bat.

```
{
	"require": {
		"jdorn/file-system-cache": "dev-master"
	}
}
```

### Manually

[](#manually)

If you aren't using Composer, you just need to include `lib/FileSystemCache.php` in your script.

```
require_once("path/to/FileSystemCache.php");
```

Setting the Cache Directory
---------------------------

[](#setting-the-cache-directory)

By default, all cached data is stored in the `cache` directory relative to the currently executing script. You can change this by setting the $cacheDir static property.

```
