Skip to content

Commit c4d6e9b

Browse files
add cache function
1 parent 2f5d008 commit c4d6e9b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/Helpers.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
use Effectra\Router\Route;
1616
use Effectra\Session\Contracts\SessionInterface;
1717
use Effectra\Session\Session;
18+
use Psr\Cache\CacheItemPoolInterface;
1819
use Psr\Http\Message\ResponseInterface;
19-
20+
use Psr\SimpleCache\CacheInterface;
2021

2122
if (!function_exists('env')) {
2223
/**
@@ -179,7 +180,17 @@ function router()
179180
return Application::container()->get(Route::class);
180181
}
181182
}
182-
183+
if (!function_exists('cache')) {
184+
/**
185+
* Get the cache instance.
186+
*
187+
* @return CacheInterface The cache instance.
188+
*/
189+
function cache():CacheInterface
190+
{
191+
return Application::container()->get(CacheInterface::class);
192+
}
193+
}
183194
if (!function_exists('session')) {
184195
/**
185196
* Get the session instance.

0 commit comments

Comments
 (0)