2017 © Pedro Peláez
 

library php-array-file-cache

Simple file-based cache system for PHP.

image

idct/php-array-file-cache

Simple file-based cache system for PHP.

  • Monday, April 23, 2018
  • by ideaconnect
  • Repository
  • 1 Watchers
  • 0 Stars
  • 383 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

idct-php-array-file-cache

Simple file-based caching system for PHP which allows storing and retrieval of data in and from files using a simple array interface., (*1)

usage example

use IDCT\FileArrayCache;

$cache = new FileArrayCache("/tmp");

//saving:
$yourData = ['value_int' => 1, 'value_string' => 'test'];
$cache["myCacheKey"] = $yourData;

//reading:
$data = $cache["myCacheKey"];

To clear all entries in cache, but keep the folder and config use clearCache() method., (*2)

installation

In case you do not use any package manager in your code then be sure to include all classes and interfaces., (*3)

Suggested way is to use Composer[https://getcomposer.org/] and install the library in your project using:, (*4)

composer require idct/php-array-file-cache

initialization

Create an instance of FileArrayCache by calling its constructor. One parameter is mandatory:, (*5)

  • $cachePath which must point to a writable and readable directory where cache will be or is stored. Warning: if a cache with cache_config file (after version 0.2) exists already in the folder then initialization will be verified with it: failure will throw a LogicException.

Optional parameters:, (*6)

  • int $levels: Amount of subfolder levels used to limit files count in a single folder. Defaults to 2., (*7)

  • IHashAlgo $hashAlgo: Algorithm used to build the filename: a hash out of the given key. Must implement IHashAlgo. Defaults to Md5., (*8)

  • ICodec $codec: Encoder / decoder which converts provided objects into strings (and the other way around) stored in files. Defaults to JsonCodec., (*9)

contribution

To contribute please just file an issue or merge request (pull request). Whenever possible please try to keep backwards-compatiblity., (*10)

Be sure to follow latest coding standards!, (*11)

The Versions

23/04 2018

dev-master

9999999-dev https://github.com/ideaconnect/idct-php-array-file-cache

Simple file-based cache system for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Bartosz Pachołek

file cache php storage serialize

08/11 2016

dev-wip_abstract_n_refactoring

dev-wip_abstract_n_refactoring https://github.com/ideaconnect/idct-php-array-file-cache

Simple file-based cache system for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Bartosz Pachołek

file cache php storage serialize