Skip to content

Latest commit

 

History

History
24 lines (21 loc) · 760 Bytes

cache.md

File metadata and controls

24 lines (21 loc) · 760 Bytes

Cache

Introduction

$key = 'my:cache:key';
cache()->clear();
cache()->get($key);
cache()->set($key, $value);
cache()->set($key, $value, 60 /* seconds */);
cache()->remember($key, function() { return time(); }); // for ever
cache()->remember($key, function() { return time(); }, 60); // for 60 seconds.
cache()->forget($key);

# with tags
cache()->tag([$tag])->clear();
cache()->tag([$tag])->get($key);
cache()->tag([$tag])->set($key, $value);
cache()->tag([$tag])->set($key, $value, 60 /* seconds */);
cache()->tag([$tag])->remember($key, function() { return time(); }); // for ever
cache()->tag([$tag])->remember($key, function() { return time(); }, 60); // for 60 seconds.
cache()->tag([$tag])->forget($key);