From c4d6e9bf14297ab596d0ffef6da05a2fa342f402 Mon Sep 17 00:00:00 2001 From: BMTmohammedtaha Date: Wed, 3 Jan 2024 12:37:29 -0800 Subject: [PATCH] add cache function --- src/Helpers.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Helpers.php b/src/Helpers.php index 1c4cbd1..ae0a1a4 100644 --- a/src/Helpers.php +++ b/src/Helpers.php @@ -15,8 +15,9 @@ use Effectra\Router\Route; use Effectra\Session\Contracts\SessionInterface; use Effectra\Session\Session; +use Psr\Cache\CacheItemPoolInterface; use Psr\Http\Message\ResponseInterface; - +use Psr\SimpleCache\CacheInterface; if (!function_exists('env')) { /** @@ -179,7 +180,17 @@ function router() return Application::container()->get(Route::class); } } - +if (!function_exists('cache')) { + /** + * Get the cache instance. + * + * @return CacheInterface The cache instance. + */ + function cache():CacheInterface + { + return Application::container()->get(CacheInterface::class); + } +} if (!function_exists('session')) { /** * Get the session instance.