2017 © Pedro Peláez
 

project cacheadapter

An adapter for using the Nette Caching Component

image

codeliter/cacheadapter

An adapter for using the Nette Caching Component

  • Monday, February 5, 2018
  • by codeliter
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

CacheAdapter

This library does not implement any functionality on its own it is written to help communicate better with the Nettecache library. It is only an adapter that streamlines caching using memcached or file storage., (*1)

Requirements

  • Php >= 5.4, (*2)

  • Composer, (*3)

  • Php Memcached extension(Optional), (*4)

Installation

  • Open your default terminal program, (*5)

  • Change your working directory to the project directory you wish to use this library in., (*6)

    You can run the following the command on mac/linux., (*7)

    cd /var/www/html/<project-directory>
    

    is where your project lives in, (*8)

  • Run the command to import the library, (*9)

    composer require codeliter/cacheadapter
    
  • That's all, (*10)

Usage

Using this library can be as easy as:, (*11)

  • Initialize the Cache Library and set the absolute or relative path of where you want the cache to be saved to, (*12)

    -If your server has Memcached loaded it uses memcached by default., (*13)

    $cache = new Codeliter\CacheAdapter\Cache('./data/cache');
  • You can save anything to Cache like this, (*14)

    $cache_name = 'test_cache';
    $data = 'This is the content of the test_case';
    $cache->save($cache_name, $data, '4 Hours');
  • You can get anything from the Cache, (*15)

    $cache_name = 'test_cache';
    $data = $cache->get($cache_name);
  • You can delete from Cache, (*16)

    $cache_name = 'test_cache';
    $cache->delete($cache_name);
  • A typical use would be, (*17)

    • Make an API or database request and store it in the cache for as long as the data would not change, (*18)

      $cache_name = 'google_home_page';
      
      try {
          // Check if the data already exists
          $data = $cache->get($cache_name);
      }
      catch (Throwable $t) {
          // If data does not exist
          // Make the API or Database request
          $request = file_get_contents('https://google.com');
          // Store the data to cache for sometime for future requests
          $cache->save($cache_name, $request, '24 Hours');
      }

Credits

The Versions

05/02 2018

dev-master

9999999-dev

An adapter for using the Nette Caching Component

  Sources   Download

MIT dbad

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette

05/02 2018

v1.0.2

1.0.2.0

An adapter for using the Nette Caching Component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette

05/02 2018

1.1.1

1.1.1.0

An adapter for using the Nette Caching Component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette

05/02 2018

v1.1.2

1.1.2.0

An adapter for using the Nette Caching Component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette

05/02 2018

v1.1.0

1.1.0.0

An adapter for using the Nette Caching Component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette

16/10 2017

1.1.0

1.1.0.0

An adapter for using the Nette Caching Component

  Sources   Download

dbad

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette

06/08 2017

1.0.0

1.0.0.0

An adapter for using the Nette Caching Component

  Sources   Download

dbad

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette

06/08 2017

v1.0.1

1.0.1.0

An adapter for using the Nette Caching Component

  Sources   Download

dbad

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette

05/08 2017

v1.0.0

1.0.0.0

An adapter for using the Nette Caching Component

  Sources   Download

dbad

The Requires

 

The Development Requires

by Abolarin Stephen

caching adapter nette