Download the PHP package iron-io/iron_cache without Composer
On this page you can find all versions of the php package iron-io/iron_cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iron-io/iron_cache
More information about iron-io/iron_cache
Files in iron-io/iron_cache
Package iron_cache
Short Description Client binding for IronCache (A key/value store in the cloud)
License MIT
Homepage http://github.com/iron-io/iron_cache_php
Informations about the package iron_cache
IronCache PHP Client
Getting Started
Get credentials
To start using iron_cache_php, you need to sign up and get an oauth token.
- Go to http://iron.io/ and sign up.
- Get an Oauth Token at http://hud.iron.io/tokens
Install iron_cache_php
There are two ways to use iron_cache_php:
Using precompiled phar archive:
Copy iron_cache.phar to target directory and include it:
Please note, phar extension available by default only from php 5.3.0 For php 5.2 you should install phar manually or use second option.
Using classes directly
- Copy
IronCache.class.phpto target directory - Grab
IronCore.class.phpthere and copy to target directory - Include both of them:
Configure
Three ways to configure IronCache:
-
Passing array with options:
-
Passing ini file name which stores your configuration options. Rename sample_config.ini to config.ini and include your Iron.io credentials (
tokenandproject_id): -
Automatic config search - pass zero arguments to constructor and library will try to find config file in following locations:
iron.iniin current directoryiron.jsonin current directoryIRON_CACHE_TOKEN,IRON_CACHE_PROJECT_IDand other environment variablesIRON_TOKEN,IRON_PROJECT_IDand other environment variables.iron.iniin user's home directory.iron.jsonin user's home directory
The Basics
Put an item in the cache:
Get an item from the cache:
Increment an item value in the cache:
Delete an item from the cache:
Cache Selection
Select cache before interacting with items
- In constructor:
$cache = new IronCache('config.ini', 'my_cache'); - By method:
$cache->setCacheName('my_cache'); - Do it later when you need:
$cache->getItem('my_cache','my_key');
Using IronCache as session store
Troubleshooting
http error: 0
If you see Uncaught exception 'Http_Exception' with message 'http error: 0 | '
it most likely caused by misconfigured cURL https sertificates.
There are two ways to fix this error:
- Disable SSL sertificate verification - add this line after IronCache initialization:
$cache->ssl_verifypeer = false; - Switch to http protocol - add this to configuration options:
protocol = httpandport = 80