2017 © Pedro Peláez
 

library filecached-php

A simple PHP key-value datastore using filesystem instead of memory

image

sharnw/filecached-php

A simple PHP key-value datastore using filesystem instead of memory

  • Wednesday, December 7, 2016
  • by Sharnw
  • Repository
  • 1 Watchers
  • 0 Stars
  • 116 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 9 % Grown

The README.md

Filecached - PHP datastore

A simple key-value datastore using filesystem instead of memory., (*1)

Useful for caching large datasets, and replacing memcache on low memory AWS instances., (*2)

Credit to https://github.com/hustcc for the original., (*3)

Installation

Add the following line to your composer.json file:, (*4)

{
    "require": {
        "sharnw/filecached-php": "dev-master"
    }
}

Usage

Similar interface to memcache, (*5)

  • set(k, v) set key-value pair
  • get(k) get key value, returns false if nothing present
  • delete(k) delete key-value pair
  • flush() wipe all cache data

Demo

require_once('src/cache.php');

$cache = new Filecached\Cache();

$example_data = [
    'time' => time(),
    'message' => 'something certainly happened today.',
];

$cache->set('todays_news', $example_data);

print_r($storeData = $cache->get('todays_news'));

$example_data = [
    [
        'url' => 'https://libraries.io/github/hustcc/php-file-cache',
        'title' => 'Forked repo'
    ],
];

$cache->set('todays_links', $example_data);

print_r($storeData = $cache->get('todays_links'));

$cache->flush('today_'); // flush all data in 'today/' namespace

$cache->set('more data', ['blah']);

$cache->flush(); // flush all data

License

Released under the terms of the MIT license., (*6)

  • Forked lib - https://libraries.io/github/hustcc/php-file-cache

The Versions

07/12 2016

dev-master

9999999-dev

A simple PHP key-value datastore using filesystem instead of memory

  Sources   Download

The Requires

  • php >=5.3