Ratings | | Unique User Downloads | | Download Rankings |
Not enough user ratings | | Total: 237 | | All time: 8,067 This week: 206 |
|
Description | | Author |
This class can store array values in PHP cache file scripts.
It can take a array value and an optional file name and store the array in a PHP cache script.
The generated script can load the original array value using a require statement. | |
|
|
Innovation award
Nominee: 1x |
|
Example
<?php
namespace ArrayCache;
/**
* Class: $classStr
* User: troy
* Date: 5/7/2016
* Time: 9:24 AM
*/
require_once 'ArrayCache.php';
$array = array(
123,
'animals' => array(
'dog',
'cat',
'mouse',
'bird'
),
'key' => 'value',
'foo' => 'bar'
);
$filename = dirname(__FILE__) . '/cache/example.php';
$ac = new ArrayCache($array, $filename);
$cachedArray = require_once $filename;
var_dump($cachedArray);
|
Details
ArrayCache
Stupid simple class capable of creating php files that return arrays.
This is a very basic class that just saves arrays in a file that return said array. I created this class primarily because I'm exceedingly lazy, and I wanted to go through as minimum of an effort as possible to save and retrieve config values.
Ultimately, I think that if you need a way to store data that will not be written very often, that's lightning fast to access, who's data can be version controlled, you don't want the extra overhead of having a db connection, and/or you don't want to json_decode or unserialize your data to stick it into an array, then this class may be for you.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.