Download the PHP package kosmosx/cache without Composer

On this page you can find all versions of the php package kosmosx/cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cache

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()

All versions of cache with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3
laravel/lumen-framework Version >=5.7
illuminate/redis Version >=5.7
predis/predis Version ^1.1
kosmosx/helpers Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kosmosx/cache contains the following files

Loading the files please wait ....