2017 © Pedro Peláez
 

library soft-cache

Soft cache for your class methods

image

felixmaier1989/soft-cache

Soft cache for your class methods

  • Wednesday, October 4, 2017
  • by felixmaier1989
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14,302 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 24 % Grown

The README.md

soft-cache

Soft cache for your class methods. Sometimes, during one script run, one method is executed several times with the same arguments. Better caching the output of it, especially when querying a databse or an API., (*1)

Usage

class TestClass {

    use SoftCache\SoftCacheTrait;

    public function getNextYearsWithCache($yearFrom, $years) {
        if ($this->checkMethodCache(__FUNCTION__, func_get_args())) {
            return $this->readMethodCache(__FUNCTION__, func_get_args());
        }
        $output = $this->getNextYearsWithoutCache($yearFrom, $years);
        $this->writeMethodCache(__FUNCTION__, func_get_args(), $output);
        return $output;
    }

    public function getNextYearsWithoutCache($yearFrom, $years) {
        return range($yearFrom + 1 , $yearFrom + $years);
    }

}

The Versions

04/10 2017

dev-master

9999999-dev

Soft cache for your class methods

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

cache php output class method

04/10 2017

0.2

0.2.0.0

Soft cache for your class methods

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

cache php output class method

22/03 2017

0.1

0.1.0.0

Soft cache for your class methods

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

cache php output class method