sarahman/json-filesystem-cache

JSON file system cache library for PHP built on top of PSR-16.

1.0.0 2019-03-31 21:25 UTC

This package is auto-updated.

Last update: 2024-04-04 12:23:14 UTC


README

v1.0.0

PHP Cache library built by PSR-16 simple cache interface

You can find implementations of the specification by looking for packages providing the psr/simple-cache-implementation virtual package.

Installation

This library is installed via Composer. To install,

  • simply add to your composer.json file: "sarahman/json-filesystem-cache": "^1.0"

OR

  • run this command:
$ composer require sarahman/sarahman/json-filesystem-cache

Usages

  • Create a file named test.php in your root directory and add these following codes:
<?php

require "vendor/autoload.php";

$cache = new Sarahman\SimpleCache\JSONFileSystemCache(); // the custom cache directory can be set through the parameter.

// Set Cache key.
$data = [
    'sample' => 'data',
    'another' => 'data'
];

$cache->set('your_custom_key', $data);

// Check cached key exists or not.
$cache->has('your_custom_key');

// Get Cached key data.
$cache->get('your_custom_key');
  • Then run php test.php.

Documentation

psr/simple-cache-implementation

Support

If you are having general issues with this package, feel free to contact me through Gmail.

If you believe you have found an issue, please report it using the GitHub issue tracker, or better yet, fork the repository and submit a pull request.

If you're using this package, I'd love to hear your thoughts. Thanks!