Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

michaelcontento/CacheDecorator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

About

Very simple caching decorator for nearly every PHP object. Everything is routed to your original object, but only once for each method and argument combination.

Example

<?php

// Will run for 7.5 million years (every time!)
$dt = new DeepThought();
echo $dt->answerToTheUltimateQuestionOfLifeTheUniverseAndEverything();

// Should be less than 7.5 million years ;)
$cache = new CacheDecorator\Engine\MemoryCache();
$fastDt = new CacheDecorator\Decorator($dt, $cache);
echo $fastDt->answerToTheUltimateQuestionOfLifeTheUniverseAndEverything();

TODOs

  • Cache the output of method calls
  • Implement caching for __toString
  • Implement caching for __invoke
  • Implement caching for __set_state
  • Define and implement handling for __clone
  • Define and implement handling of __destruct
  • Define and implement handling of __sleep and __wakeup

Get the tests running

  • Install PHPUnit
    • pear config-set auto_discover 1
    • pear install pear.phpunit.de/PHPUnit
  • Install Composer and all other dependencies
    • wget http://getcomposer.org/composer.phar
    • php composer.phar install
  • And finally run PHPUnit
    • phpunit

License

Copyright 2009-2012 Michael Contento <michaelcontento@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Very simple caching decorator for all PHP objects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors