{"id":14974488,"url":"https://github.com/kosmosx/cache","last_synced_at":"2025-10-27T09:30:30.773Z","repository":{"id":57008663,"uuid":"152264991","full_name":"KosmosX/cache","owner":"KosmosX","description":"Laravel \u0026 Lumen Cache Service | File and Redis cache system","archived":false,"fork":false,"pushed_at":"2019-08-24T11:26:08.000Z","size":68,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T04:31:41.904Z","etag":null,"topics":["cache","cache-storage","laravel-redis-cache","laravel5","lumen","php-cache","redis-cache","serializer"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KosmosX.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-09T14:24:09.000Z","updated_at":"2023-11-17T08:15:41.000Z","dependencies_parsed_at":"2022-08-21T12:40:42.444Z","dependency_job_id":null,"html_url":"https://github.com/KosmosX/cache","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KosmosX%2Fcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KosmosX%2Fcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KosmosX%2Fcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KosmosX%2Fcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KosmosX","download_url":"https://codeload.github.com/KosmosX/cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238471962,"owners_count":19478135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","cache-storage","laravel-redis-cache","laravel5","lumen","php-cache","redis-cache","serializer"],"created_at":"2024-09-24T13:50:38.214Z","updated_at":"2025-10-27T09:30:30.445Z","avatar_url":"https://github.com/KosmosX.png","language":"PHP","readme":"# Cache System\n\n![](https://img.shields.io/badge/version-1.0.0-green.svg) ![](https://img.shields.io/badge/laravel-\u003e=5.7-blue.svg) ![](https://img.shields.io/badge/lumen-\u003e=5.7-blue.svg)\n\n##### Why use it?\n\u003eManage your cache easily.\nThis 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.\n\n\n##### Install \u0026 Configuration\n    \n    composer require kosmosx/cache\n\nYou must enter the following provider in the bootstrap/app.php file:\nUncomment the function \n    \n    $app-\u003ewithFacades();\n\nLoad configuration in boostrap file\n\n\t$this-\u003econfigure('cache');\n\t$this-\u003econfigure('database');\nOr publish config in your Service Provider\n\n    $this-\u003epublishes([\n        'Kosmosx/Cache/config/cache.php' =\u003e config_path('cache.php')\n    ], 'config');\n    \n    $this-\u003epublishes([\n        'Kosmosx/Cache/config/database.php' =\u003e config_path('database.php')\n    ], 'config');\n    \nRegister service provider \n    \n    $app-\u003eregister(Kosmosx\\Cache\\CacheServiceProvider::class);\n\n#### Documentation\nOnce you have cofigured using it:\n\n    $factory = app('factory.cache');            //return CacheFactory\n    $builderFile = $factory-\u003efile();            //return FileBuilder\n    $builderRedis = $factory-\u003eredis();          //return RedisBuilder\n        \n    $file = app('service.cache.file');          //FileCommand\n    $redis = app('service.cache.redis');        //RedisCommand\n\n**SET**\n\n    //If you use builder obj  \n    $builderRedis-\u003edefault()-\u003eset($key, $value, $ttl);          //build FileCommand with DefaultSerializer and set cache\n    $builderRedis-\u003eresponse()-\u003eset($response, $value, $ttl);\n    $builderRedis-\u003ecollect()-\u003eset($collect, $value, $ttl);\n    \n    //With services \n    $file-\u003eset($key, $value, $ttl);\n    $redis-\u003eset($key, $value, $ttl);\n\n**SET MANY**\n\n    //array example: [\"key\" =\u003e $value, \"key2\" =\u003e $value2 ...]\n    //$ttl for all values\n    \n    $builderFile-\u003edefault()-\u003esetMany(array $values, $ttl);\n    \n    $file-\u003esetMany(array $values, $ttl);\n    $redis-\u003esetMany(array $values, $ttl);\n    \n**GET**\n    \n    $file-\u003eget($key, $serializer);\n    $redis-\u003eget($key, $serializer);\n    \n**GET MANY**\n\n    //array example: [\"key\", \"key2\", \"keyN\" ...]\n    \n    $file-\u003egetMany(array $keys);\n    $redis-\u003egetMany(array $keys);\n    \n**SERIALIZER**\n\nAll data stored in cache (redis / file) are serialized with the json coding, so as to make them transportable by other languages.\nit is possible to use typed serializers, so that when it is recovered it is possible to reconstruct the initial object. \n    \n    //Serializer \n    ResponseSerializer()  //If you want cache Response object \n    CollectSerializer()   //If you want cache Collect object \n    DefaultSerializer()   //default cache\n    \n    ...-\u003esetSerializer(new ResponseSerializer());\n                  \n**Own Serializer**\n\nIf you want to create your own serializer, just create a class that extends SerializerAbstract\n\n    use Kosmosx\\Cache\\Serializer\\Abstracts\\Serializer;\n    use Kosmosx\\Cache\\Serializer\\Interfaces\\SerializerInterface;\n        \n    class {name} extends Serializer implements SerializerInterface\n\n**Other function**\n\n     //Use class cache manager \n     ...-\u003emanager()\t//return istance of Illuminate/Redis or CacheManager     \n     \n     ...-\u003eforget(string $keys)\n     ...-\u003eforgetMany(array $keys)\n     \n     ...-\u003esetAutodetect($bool)\n     ...-\u003egetAutodetect()\n     \n     ...-\u003eclear()\n         \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkosmosx%2Fcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkosmosx%2Fcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkosmosx%2Fcache/lists"}