GithubHelp home page GithubHelp logo

apc-cache-class's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.