From da531e82f2a3a3fbceb71c64a20b7737519cecdc Mon Sep 17 00:00:00 2001 From: rishtigupta Date: Fri, 26 Apr 2024 10:22:00 -0700 Subject: [PATCH 1/3] fix: remove create cache on every call --- README.md | 5 ++++- src/MomentoStore.php | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a2b1d7d..d88708c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ - A Momento API Key is required, you can generate one using the [Momento Console](https://console.gomomento.com) +- A Momento cache is required, you can generate one by choosing the desired cloud provider and region using + the [Momento Console](https://console.gomomento.com/create) - At least PHP 8.0 - [Composer](https://getcomposer.org/doc/00-intro.md) - At least [Laravel 9.x](https://laravel.com/docs/9.x/installation) @@ -48,7 +50,8 @@ Then, add `MomentoServiceProvider` to your `config/app.php`: And add `MOMENTO_API_KEY`= into your `.env` file -Finally, add the required config to your `config/cache.php`: +Finally, add the required config to your `config/cache.php`, +`MOMENTO_CACHE_NAME` being the name of the cache you created above: ```php 'default' => env('CACHE_DRIVER', 'momento'), diff --git a/src/MomentoStore.php b/src/MomentoStore.php index a4902a0..9957c0a 100644 --- a/src/MomentoStore.php +++ b/src/MomentoStore.php @@ -24,7 +24,6 @@ public function __construct(string $cacheName, int $defaultTtl) $configuration = Laptop::latest(); $this->client = new CacheClient($configuration, $authProvider, $defaultTtl); $this->cacheName = $cacheName; - $this->client->createCache($cacheName); } public function get($key): ?string From 32ce401db07f433fa5dbd944a103b5ee3e2e9be6 Mon Sep 17 00:00:00 2001 From: rishtigupta Date: Fri, 26 Apr 2024 10:44:34 -0700 Subject: [PATCH 2/3] fix: update readme --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d88708c..02bed17 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,13 @@ Then, add `MomentoServiceProvider` to your `config/app.php`: ]; ``` -And add `MOMENTO_API_KEY`= into your `.env` file +And add: +- `MOMENTO_API_KEY`= +- `MOMENTO_CACHE_NAME`= -Finally, add the required config to your `config/cache.php`, -`MOMENTO_CACHE_NAME` being the name of the cache you created above: +into your `.env` file + +Finally, add the required config to your `config/cache.php`: ```php 'default' => env('CACHE_DRIVER', 'momento'), From 91dae170139085fbe38323f0e787efeef2aeef09 Mon Sep 17 00:00:00 2001 From: rishtigupta Date: Fri, 26 Apr 2024 11:02:08 -0700 Subject: [PATCH 3/3] fix: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 02bed17..a972854 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - A Momento API Key is required, you can generate one using the [Momento Console](https://console.gomomento.com) -- A Momento cache is required, you can generate one by choosing the desired cloud provider and region using +- A Momento cache is required, you can generate one using the [Momento Console](https://console.gomomento.com/create) - At least PHP 8.0 - [Composer](https://getcomposer.org/doc/00-intro.md)