2017 © Pedro Peláez
 

library memory

Store your data in ram, database, session and cookie.

image

codedgr/memory

Store your data in ram, database, session and cookie.

  • Friday, June 8, 2018
  • by codedgr
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Memory

This library helps you to store temporary data in your memory, database, cookie or session. Use it to cache data to improve the speed of your script., (*1)

Install

Using Composer, (*2)

"require": {
    "codedgr/memory": "~1.0"
}

Initialize the memory. Note that cookie does not need to initialized., (*3)

Ram::init();
Session::init();
Database::init($pdo);

Add data to the cache if the cache $key doesn't already exist. If it does exist, the data is not added and the function returns false., (*4)

Ram::add($key, $data, $expire);
Session::add($key, $data, $expire);
Database::add($key, $data, $expire);
Cookie::add($key, $data, $expire);

Add data to the cache. If the cache $key already exists, then it will be overwritten; if not then it will be created., (*5)

Ram::set($key, $data, $expire);
Session::set($key, $data, $expire);
Database::set($key, $data, $expire);
Cookie::set($key, $data, $expire);

Replaces the given cache if it exists, returns false otherwise., (*6)

Ram::replace($key, $expire, $group);
Session::replace($key, $expire, $group);
Database::replace($key, $expire, $group);
Cookie::replace($key, $expire, $group);

Get the value of the cached object, or false if the cache $key doesn't exist., (*7)

To disambiguate a cached false from a non-existing $key, you should do absolute testing of $found, which is passed by reference, against false: if $found === false, the key does not exist., (*8)

Ram::get($key, $expire, &$found = null);
Session::get($key, $expire, &$found = null);
Database::get($key, $expire, &$found = null);
Cookie::get($key, $expire, &$found = null);

Clears data from the cache for the given $key., (*9)

Ram::delete($key, $expire);
Session::delete($key, $expire);
Database::delete($key, $expire);
Cookie::delete($key, $expire);

Clears all cached data. Note that you can't flash the cookie memory., (*10)

Ram::flush();
Session::flush();
Database::flush();

The Versions

08/06 2018

dev-master

9999999-dev https://github.com/codedgr/memory

Store your data in ram, database, session and cookie.

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

The Development Requires

database cache cookie memory

08/06 2018

1.0.1

1.0.1.0 https://github.com/codedgr/memory

Store your data in ram, database, session and cookie.

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

The Development Requires

database cache cookie memory

08/06 2018

1.0.0

1.0.0.0 https://github.com/codedgr/cache

Cache to memory or database

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

The Development Requires

database cache memory