Giter VIP home page Giter VIP logo

cache's Introduction

Effectra\Cache

Effectra\Cache is a package that provides cache implementations based on the PSR-16 (Simple Cache) standard. It includes cache classes that can be used to store and retrieve data in various cache storage systems.

Features

  • PSR-16 compatibility: Implements the Psr\SimpleCache\CacheInterface.
  • Easy integration: Provides cache implementations for different cache storage systems.
  • Flexible configuration: Supports different cache configurations based on the chosen storage system.
  • Clean and simple API: Offers a straightforward API for caching data.

Installation

You can install the package via Composer. Run the following command in your project directory:

composer require effectra/cache

Usage

The package includes various cache classes, each representing a different cache storage system. You can use the desired cache class based on your requirements. Here's an example of using the JsonCache class:

use Effectra\Cache\Psr16\JsonCache;

// Create an instance of the JsonCache class with the cache directory
$cache = new JsonCache('/path/to/cache/directory');

// Store a value in the cache with a key and optional time-to-live (TTL)
$cache->set('key', 'value', 3600); // Cache value with a TTL of 1 hour

// Retrieve a value from the cache
$result = $cache->get('key');

// Delete a value from the cache
$cache->delete('key');

// Clear the entire cache
$cache->clear();

Available Cache Classes

  • FileCache: Stores cache data in individual files on the file system.
  • JsonCache: Stores cache data in JSON files on the file system.
  • RedisCache: Stores cache data in a Redis server.

Please refer to the respective class documentation and the PSR-16 specification for more details on the methods and usage.

Requirements

  • PHP >= 7.2
  • Composer (for installation)

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

License

This package is open source and available under the MIT License.

cache's People

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.