library soft-cache
Soft cache for your class methods
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
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);
}
}
dev-master
9999999-dev
Soft cache for your class methods
Sources
Download
MIT
The Requires
The Development Requires
cache
php
output
class
method
0.2
0.2.0.0
Soft cache for your class methods
Sources
Download
MIT
The Requires
The Development Requires
cache
php
output
class
method
0.1
0.1.0.0
Soft cache for your class methods
Sources
Download
MIT
The Requires
The Development Requires
cache
php
output
class
method