Code

3S Caching System (Cache API results and PHP data)

3S Caching System (Cache API results and PHP data)

This caching system has been built to be able to cache API requests (coming from Facebook, Twitter, YouTube etc, that often returns json results or XML results). It can also be used to cache PHP data (like big SQL results, arrays, json, etc).

The 3S stands for 3 storage. This item can use 3 types of different storages: SQLite, file system and MySQL.

Features

- Caching API results (YouTube, Facebook, Twitter)
- Can cache XMLs, json, PHP arrays, variables and even HTML .
- 3 types of storages: SQLite, Files or MySQL.
- No configuration if used with the file system or SQLite.
- Configuration in less than 2 minutes if used with MySQL.
- Define for how long a data should be cached.
- Extremely easy to use in your existing website.

Benefits

- Speed up your website by caching strategic data.
- Avoid being rejected by API providers by limiting requests.

Use example

Cache a data for 120 seconds:
$c1 = new Yp_cache();
$c1->cache_set(array(‘key’=>‘123’, ‘data’=>$data, ‘expire’=>‘120’));

Get a cached data:
$data = $c1->cache_get(array(‘key’=>‘123’));
print_r($data);

Delete a cached data:
$c1->cache_delete(array(‘key’=>‘123’));

Delete all cached data:
$c1->cache_flush();

by
by
by
by
by
by