GitXplorerGitXplorer
r

APC-Cache-Class

public
6 stars
3 forks
0 issues

Commits

List of commits on branch master.
Unverified
2217b4dc39ac4862272fa1c1b6c9eb4a757286e0

Add require for apc extension

rrcastera committed 11 years ago
Unverified
ee104f9b2128a5d8862bceab01f3f83e0e9b73b2

Fix invalid json

rrcastera committed 11 years ago
Unverified
e01ee096aa16e2906260db4fa68668d7f4254a87

Add composer file

rrcastera committed 11 years ago
Unverified
b032a02d7f6be02b37f271fbcb12ea5807546750

Update readme

rrcastera committed 11 years ago
Unverified
f34500f8023df3387b4d753efa189df3ceb351f1

Update apc class

rrcastera committed 11 years ago
Unverified
91335bb6d783881812a54f262e4b423b43c1d9cc

Update once more; leave composer.lock

rrcastera committed 11 years ago

README

The README file for this repository.

ApcCache

The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. This class is in simple form, an Abstraction to the APC Library.

Setup

Add a composer.json file to your project:

{
  "require": {
      "rcastera/apc": "v1.0.0"
  }
}

Then provided you have composer installed, you can run the following command:

$ composer.phar install

That will fetch the library and its dependencies inside your vendor folder. Then you can add the following to your .php files in order to use the library

require 'vendor/autoload.php';

Then you need to use the relevant class, for example:

use rcastera\Apc\ApcCache;

Example

require 'vendor/autoload.php';

use rcastera\Apc\ApcCache;

// Create a new object with properties to store in cache.
$object = new stdClass;
$object->name = 'Richard';
$object->age = 30;

// Store the object in cache.
ApcCache::store('rich', $object, 3600);

// Now check if it exists and fetch it.
if (ApcCache::exists('rich')) {
    $person = ApcCache::fetch('rich');
}

// Output the name property value.
echo $person->name;

// Delete this specific key in cache.
ApcCache::delete('rich');

// Delete all cache.
ApcCache::clear();

Contributing

  1. Fork it.
  2. Create a branch (git checkout -b my_branch)
  3. Commit your changes (git commit -am "Added something")
  4. Push to the branch (git push origin my_branch)
  5. Create an [Issue][1] with a link to your branch
  6. Enjoy a refreshing Coke and wait