2017 © Pedro Peláez
 

library object-cache-proxy

Allow cache results for execution object method. Transparent to working code.

image

andydune/object-cache-proxy

Allow cache results for execution object method. Transparent to working code.

  • Thursday, June 14, 2018
  • by AndyDune
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

ObjectCacheProxy

Build Status Software License Packagist Version Total Downloads, (*1)

Allow cache results for execution object method. Transparent to working code., (*2)

Installation

Installation with composer:, (*3)

composer require andydune/object-cache-proxy

Or if composer didn't install globally:, (*4)

php composer.phar require andydune/object-cache-proxy

Or edit your composer.json:, (*5)

"require" : {
     "andydune/object-cache-proxy": "^1"
}

And execute command:, (*6)

php composer.phar update

Problem

Here is instance of any class. We use setters for inject data and finally execute the last method for retrieve data. We do it often with narrow range of input data. How can we simple to change it for speedup?, (*7)

$instance = new Adventures(); // any class

// Use some setters 
$instance->setDirection('up');
$instance->setSpeed('low');
$instance->setLimit(13);

// Next is results
$ways = $instance->get(); 

We can use ObjectCacheProxy to cache it with minimum work code change., (*8)

use AndyDune\ObjectCacheProxy\ObjectCacheProxy;
use Symfony\Component\Cache\Simple\FilesystemCache;

$instanceOrigin = new \Adventures(); // any class

$instance = new ObjectCacheProxy(new FilesystemCache());

// inject object and method name witch results will be cached. 
$instance->setObject($instanceOrigin, 'get');

// Use some setters 
$instance->setDirection('up');
$instance->setSpeed('low');
$instance->setLimit(13);

// Next is results
$ways = $instance->get(); 

ObjectCacheProxy gets work class instance and intercept methods are called to it. It accumulates setter methods and parameters as cache key and executes them at ones before execution method get., (*9)

The Versions

14/06 2018

dev-php_56

dev-php_56 https://github.com/AndyDune/ObjectCacheProxy

Allow cache results for execution object method. Transparent to working code.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

php array

14/06 2018

v1.1.1

1.1.1.0 https://github.com/AndyDune/ObjectCacheProxy

Allow cache results for execution object method. Transparent to working code.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

php array

31/05 2018

dev-master

9999999-dev https://github.com/AndyDune/ObjectCacheProxy

Allow cache results for execution object method. Transparent to working code.

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

php array

29/05 2018

v1.0.1

1.0.1.0 https://github.com/AndyDune/ObjectCacheProxy

Allow cache results for execution object method. Transparent to working code.

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

php array

28/05 2018

v1.0.0

1.0.0.0 https://github.com/AndyDune/ObjectCacheProxy

Allow cache results for execution object method. Transparent to working code.

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

php array