Cache.php
TLDR
This file contains the Cache
facade class, which provides convenient access to the caching functionality in Laravel. The class serves as a static proxy to the underlying cache repository, allowing developers to perform caching operations without the need to explicitly instantiate the repository object.
Methods
store
Returns a cache repository instance for the specified cache store.
driver
Returns a cache repository instance using the specified cache driver.
resolve
Resolves a cache repository instance using the specified cache store.
repository
Creates a cache repository instance using the specified cache store.
refreshEventDispatcher
Refreshes the cache event dispatcher.
getDefaultDriver
Gets the default cache driver name.
setDefaultDriver
Sets the default cache driver name.
forgetDriver
Removes the specified cache driver.
purge
Purges the cache store or the specified cache item.
extend
Extends the cache system with a custom driver.
setApplication
Sets the application instance for the cache manager.
has
Checks if a cache item exists for the specified key(s).
missing
Checks if a cache item is missing for the specified key.
get
Retrieves a cache item for the specified key(s).
many
Retrieves multiple cache items for the specified keys.
getMultiple
Retrieves multiple cache items for the specified keys using an iterable.
pull
Retrieves and removes a cache item for the specified key(s).
put
Stores a cache item with the specified key(s) and value.
set
Stores a cache item with the specified key and value, and optionally sets a TTL for the item.
putMany
Stores multiple cache items.
setMultiple
Stores multiple cache items using an iterable.
add
Stores a cache item if it does not already exist.
increment
Increments the value of a cache item.
decrement
Decrements the value of a cache item.
forever
Stores a cache item with an infinite TTL.
remember
Retrieves a cache item, or stores and returns it if it does not exist.
sear
Retrieves a cache item, or stores and returns it if it does not exist, using a callback function.
rememberForever
Retrieves a cache item, or stores and returns it if it does not exist, with an infinite TTL.
forget
Removes a cache item for the specified key.
delete
Alias for the forget
method.
deleteMultiple
Removes multiple cache items.
clear
Clears the cache store.
tags
Gets a tagged cache instance.
supportsTags
Checks if the cache store supports cache tagging.
getDefaultCacheTime
Gets the default cache time in seconds.
setDefaultCacheTime
Sets the default cache time in seconds.
getStore
Gets the currently configured cache store.
setStore
Sets the cache store to use.
getEventDispatcher
Gets the event dispatcher instance.
setEventDispatcher
Sets the event dispatcher instance.
macro
Defines a new macro method for the Cache facade.
mixin
Mixes another object into the Cache facade.
hasMacro
Checks if a macro method is defined for the Cache facade.
flushMacros
Flushes all macro methods defined for the Cache facade.
macroCall
Dynamically handles calls to macro methods on the Cache facade.
flush
Flushes the cache store.
getPrefix
Gets the cache key prefix.
lock
Creates a cache lock instance.
restoreLock
Restores a cache lock instance.
Classes
There are no additional classes defined in this file.
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null)
* @method static \Illuminate\Contracts\Cache\Repository driver(string|null $driver = null)
* @method static \Illuminate\Contracts\Cache\Repository resolve(string $name)
* @method static \Illuminate\Cache\Repository repository(\Illuminate\Contracts\Cache\Store $store)
* @method static void refreshEventDispatcher()
* @method static string getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static \Illuminate\Cache\CacheManager forgetDriver(array|string|null $name = null)
* @method static void purge(string|null $name = null)
* @method static \Illuminate\Cache\CacheManager extend(string $driver, \Closure $callback)
* @method static \Illuminate\Cache\CacheManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static bool has(array|string $key)
* @method static bool missing(string $key)
* @method static mixed get(array|string $key, mixed|\Closure $default = null)
* @method static array many(array $keys)
* @method static iterable getMultiple(iterable $keys, mixed $default = null)
* @method static mixed pull(array|string $key, mixed|\Closure $default = null)
* @method static bool put(array|string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
* @method static bool set(string $key, mixed $value, null|int|\DateInterval $ttl = null)
* @method static bool putMany(array $values, \DateTimeInterface|\DateInterval|int|null $ttl = null)
* @method static bool setMultiple(iterable $values, null|int|\DateInterval $ttl = null)
* @method static bool add(string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
* @method static int|bool increment(string $key, mixed $value = 1)
* @method static int|bool decrement(string $key, mixed $value = 1)
* @method static bool forever(string $key, mixed $value)
* @method static mixed remember(string $key, \Closure|\DateTimeInterface|\DateInterval|int|null $ttl, \Closure $callback)
* @method static mixed sear(string $key, \Closure $callback)
* @method static mixed rememberForever(string $key, \Closure $callback)
* @method static bool forget(string $key)
* @method static bool delete(string $key)
* @method static bool deleteMultiple(iterable $keys)
* @method static bool clear()
* @method static \Illuminate\Cache\TaggedCache tags(array|mixed $names)
* @method static bool supportsTags()
* @method static int|null getDefaultCacheTime()
* @method static \Illuminate\Cache\Repository setDefaultCacheTime(int|null $seconds)
* @method static \Illuminate\Contracts\Cache\Store getStore()
* @method static \Illuminate\Cache\Repository setStore(\Illuminate\Contracts\Cache\Store $store)
* @method static \Illuminate\Contracts\Events\Dispatcher getEventDispatcher()
* @method static void setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
* @method static bool flush()
* @method static string getPrefix()
* @method static \Illuminate\Contracts\Cache\Lock lock(string $name, int $seconds = 0, string|null $owner = null)
* @method static \Illuminate\Contracts\Cache\Lock restoreLock(string $name, string $owner)
*
* @see \Illuminate\Cache\CacheManager
*
* @mixin \Illuminate\Cache\Repository
*/
class Cache extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'cache';
}
}