Giter Club home page Giter Club logo

cache's Introduction

Cache

Build Status

A symple cache library. Implements different adapters that you can use and change easily by a manager or similar.

Installation

With Composer

It is best installed it through packagist by including desarrolla2/cache in your project composer.json require:

    "require": {
        // ...
        "desarrolla2/cache":  "dev-master"
    }

Without Composer

You can also download it from [Github] (https://github.com/desarrolla2/Cache), but no autoloader is provided so you'll need to register it with your own PSR-0 compatible autoloader.

Usage

    <?php

    use Desarrolla2\Cache\Cache;
    use Desarrolla2\Cache\Adapter\NotCache;

    $cache = new Cache(new NotCache());

    $cache->set('key', 'myKeyValue', 3600);

    // later ...

    echo $cache->get('key');

Adapters

NotCache

Use it if you will not implement any cache adapter is an adapter that will serve to fool the test environments.

File

Use it if you will you have dont have other cache system available in your system or if you like to do your code more portable.

    <?php
    
    use Desarrolla2\Cache\Cache;
    use Desarrolla2\Cache\Adapter\File;

    $cacheDir = '/tmp';
    $adapter = new File($cacheDir);
    $adapter->setOption('ttl', 3600);
    $cache = new Cache($adapter);

Apc

Use it if you will you have APC cache available in your system.

    <?php
    
    use Desarrolla2\Cache\Cache;
    use Desarrolla2\Cache\Adapter\Apc;


    $adapter = new Apc();
    $adapter->setOption('ttl', 3600);
    $cache = new Cache($adapter);

Mongo

Use it if you will you have mongodb available in your system.

    <?php
    
    use Desarrolla2\Cache\Cache;
    use Desarrolla2\Cache\Adapter\Mongo;

    $server = 'mongodb://localhost:27017';
    $adapter = new Mongo($ server);
    $adapter->setOption('ttl', 3600);
    $cache = new Cache($adapter);

Coming soon

This library implements other adapters as soon as possible, feel free to send new adapters if you think it appropriate.

This can be a list of pending tasks.

  • Cleanning cache
  • MemcachedAdapter
  • Other Adapters

Contact

You can contact with me on @desarrolla2.

cache's People

Contributors

desarrolla2 avatar gries avatar itn3rd77 avatar

Watchers

 avatar  avatar

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.