gsferro/autocacheeasy

This package is abandoned and no longer maintained. No replacement package was suggested.

Package to perform the autocache in an easy way in Laravel with Redis

Maintainers

Package info

github.com/GuilhermeFerro/laravel-autocache-easy

pkg:composer/gsferro/autocacheeasy

Statistics

Installs: 12

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2021-05-10 04:44 UTC

This package is auto-updated.

Last update: 2021-12-27 20:39:25 UTC


README

EN

  • Package to perform the autocache in an easy way in Laravel with Redis
  • This package was inspired by the amitavroy/rediscache and use it internally

PT-BR

  • Pacote para realizar o autocache de uma forma easy no Laravel com Redis
  • Este pacote foi inspirado no amitavroy/rediscache e o usa internamente

Installation

composer require gsferro/autocacheeasy

Dependencies

"predis/predis": "^1.1",

Use

  • Global instance autocacheeasy()
/**
* Package instance
* Instancia do pacote
*
* @param string $keyPrefix default null, 
* @param string $keyPrefixSeparetor default ':' 
* @return AutoCacheEasyService
*/
$autocacheeasy = autocacheeasy();
  • Alias autocache()
/**
* Alias small for autocacheeasy().
*
* @return Gsferro\AutoCacheEasy\Services\AutoCacheEasyService
*/
$autocache = autocache();
  • Method Remember
autocacheeasy()->remember(string $key, $ttl, \Closure $callback)
  • Method RememberForever
autocacheeasy()->remember(string $key, $ttl, \Closure $callback)
  • Method Retriver
autocacheeasy()->retriver(string $key, \Closure $callback, $all = false)

Methods Packages Inspire/Dependencie

EN

  • By using this package, you still retain all the functions of the dependency package.

PT-BR

  • Ao usar este pacote, você ainda mantém todas as funções do pacote de dependência.
Method Package Depedence \Illuminate\Cache\CacheManager

EN

  • To access the cache directly

PT-BR

  • Para ter acesso ao cache diretamente
autocacheeasy()->cache
Method Package Depedence predis/predis

EN

  • To access the predis directly

PT-BR

  • Para ter acesso ao predis diretamente
autocacheeasy()->redis
Method Package Inspire amitavroy/rediscache
autocacheeasy()->get($key) 

autocacheeasy()->set($key, $value) 

autocacheeasy()->getAll($key) 

autocacheeasy()->forget($key, $wildcard = false) 

Package ResponseView

EN

  • Response easy the dates from views
  • add Trait ResponseViewCache in your Controller

PT-BR

/**
* Easily add an item to ResponseView :: $ data and cache it
* Adicionar forma fácil um item ao ResponseView::$data e coloca no cache
*
* @param string $key
* @param callable $value
* @param int $time 60
*/
$this->addDataCache(string $key, callable value, int $time 60)
  • Method addMergeDataCache
/**
* Easily add an item to ResponseView::$mergeData and cache it
* Adicionar forma fácil um item ao ResponseView::$mergeData e coloca no cache
*
* @param string $key
* @param callable $value
* @param int $time 60
*/
$this->addMergeDataCache(string $key, callable value, int $time 60)
  • Method addDataOtherKeyCache
/**
* Easily add an item to ResponseView::$data and cache it
* Adicionar forma fácil um item ao ResponseView::$data e coloca no cache
*
* @param string $key
* @param string $keyCache
* @param callable $value
* @param int $time 60
*/
$this->addDataOtherKeyCache( string $key, string $keyCache, callable value, int $time 60 )
  • Method addMergeDataOtherKeyCache
/**
* Easily add an item to ResponseView::$mergeData and cache it
* Adicionar forma fácil um item ao ResponseView::$mergeData e coloca no cache
*
* @param string $key
* @param string $keyCache
* @param callable $value
* @param int $time 60
*/
$this->addMergeDataOtherKeyCache( string $key, string $keyCache, callable value, int $time 60 )