All Projects → KosmosX → cache

KosmosX / cache

Licence: other
Laravel & Lumen Cache Service | File and Redis cache system

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to cache

laravel5-hal-json
Laravel 5 HAL+JSON API Transformer Package
Stars: ✭ 15 (-21.05%)
Mutual labels:  serializer, lumen, laravel5
Laravel Microservices
Pseudo-microservices project written in Laravel
Stars: ✭ 138 (+626.32%)
Mutual labels:  lumen, laravel5
php-framework-benchmark
php framework benchmark (include laravel、symfony、silex、lumen、slim、yii2、tastphp etc)
Stars: ✭ 17 (-10.53%)
Mutual labels:  lumen, laravel5
Laravel5 Jsonapi
Laravel 5 JSON API Transformer Package
Stars: ✭ 313 (+1547.37%)
Mutual labels:  lumen, laravel5
laravel5-jsonapi-dingo
Laravel5 JSONAPI and Dingo together to build APIs fast
Stars: ✭ 29 (+52.63%)
Mutual labels:  serializer, laravel5
CSV
A simple CSV file parser and serializer
Stars: ✭ 31 (+63.16%)
Mutual labels:  serializer
gonrails
Rails like mvc backend application with golang .
Stars: ✭ 37 (+94.74%)
Mutual labels:  serializer
ember-airtable
Boilerplate for quickly prototyping apps with Airtable, Node & Ember
Stars: ✭ 21 (+10.53%)
Mutual labels:  serializer
zeroformatter
golang version zeroformatter
Stars: ✭ 29 (+52.63%)
Mutual labels:  serializer
paper-wallet
stellar.github.io/paper-wallet/
Stars: ✭ 41 (+115.79%)
Mutual labels:  lumen
dingo-serializer-switch
A middleware to switch fractal serializers in dingo
Stars: ✭ 49 (+157.89%)
Mutual labels:  serializer
generator-laravel-5
Scaffold Laravel 5.7 applications with ease.
Stars: ✭ 19 (+0%)
Mutual labels:  laravel5
mysqly
Full-featured opensource small-overhead PHP data framework for Mysql built for fast and efficient development
Stars: ✭ 18 (-5.26%)
Mutual labels:  cache-storage
Uragano
Uragano, A simple, high performance RPC library. Support load balancing, circuit breaker, fallback, caching, intercepting.
Stars: ✭ 28 (+47.37%)
Mutual labels:  redis-cache
database-journal
Databases: Concepts, commands, codes, interview questions and more...
Stars: ✭ 50 (+163.16%)
Mutual labels:  redis-cache
tag-cache
Tagged Cache implementation over redis
Stars: ✭ 16 (-15.79%)
Mutual labels:  redis-cache
Laravel-5.3-Repository
Simple repository setup for Laravel 5.3
Stars: ✭ 17 (-10.53%)
Mutual labels:  laravel5
laravel-redis-sentinel-drivers
Redis Sentinel integration for Laravel and Lumen.
Stars: ✭ 100 (+426.32%)
Mutual labels:  lumen
laravel-adminlte-boilerplate
Laravel 5.6+ AdminLTE
Stars: ✭ 45 (+136.84%)
Mutual labels:  laravel5
laravel-fiverrclone
Full functional fiverr clone
Stars: ✭ 23 (+21.05%)
Mutual labels:  laravel5

Cache System

Why use it?

Manage your cache easily. This package is useful for better managing the File or Redis cache. Implements the functions for creating and returning caches using json-encoded serialization to make the cache transportable and usable by other external microservices.

Install & Configuration
composer require kosmosx/cache

You must enter the following provider in the bootstrap/app.php file: Uncomment the function

$app->withFacades();

Load configuration in boostrap file

$this->configure('cache');
$this->configure('database');

Or publish config in your Service Provider

$this->publishes([
    'Kosmosx/Cache/config/cache.php' => config_path('cache.php')
], 'config');

$this->publishes([
    'Kosmosx/Cache/config/database.php' => config_path('database.php')
], 'config');

Register service provider

$app->register(Kosmosx\Cache\CacheServiceProvider::class);

Documentation

Once you have cofigured using it:

$factory = app('factory.cache');            //return CacheFactory
$builderFile = $factory->file();            //return FileBuilder
$builderRedis = $factory->redis();          //return RedisBuilder
    
$file = app('service.cache.file');          //FileCommand
$redis = app('service.cache.redis');        //RedisCommand

SET

//If you use builder obj  
$builderRedis->default()->set($key, $value, $ttl);          //build FileCommand with DefaultSerializer and set cache
$builderRedis->response()->set($response, $value, $ttl);
$builderRedis->collect()->set($collect, $value, $ttl);

//With services 
$file->set($key, $value, $ttl);
$redis->set($key, $value, $ttl);

SET MANY

//array example: ["key" => $value, "key2" => $value2 ...]
//$ttl for all values

$builderFile->default()->setMany(array $values, $ttl);

$file->setMany(array $values, $ttl);
$redis->setMany(array $values, $ttl);

GET

$file->get($key, $serializer);
$redis->get($key, $serializer);

GET MANY

//array example: ["key", "key2", "keyN" ...]

$file->getMany(array $keys);
$redis->getMany(array $keys);

SERIALIZER

All data stored in cache (redis / file) are serialized with the json coding, so as to make them transportable by other languages. it is possible to use typed serializers, so that when it is recovered it is possible to reconstruct the initial object.

//Serializer 
ResponseSerializer()  //If you want cache Response object 
CollectSerializer()   //If you want cache Collect object 
DefaultSerializer()   //default cache

...->setSerializer(new ResponseSerializer());

Own Serializer

If you want to create your own serializer, just create a class that extends SerializerAbstract

use Kosmosx\Cache\Serializer\Abstracts\Serializer;
use Kosmosx\Cache\Serializer\Interfaces\SerializerInterface;
    
class {name} extends Serializer implements SerializerInterface

Other function

 //Use class cache manager 
 ...->manager()	//return istance of Illuminate/Redis or CacheManager     
 
 ...->forget(string $keys)
 ...->forgetMany(array $keys)
 
 ...->setAutodetect($bool)
 ...->getAutodetect()
 
 ...->clear()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].