Skip to content

Commit

Permalink
notify user that he is trying to use RR KV without installing corresp…
Browse files Browse the repository at this point in the history
…onding php package
  • Loading branch information
Rostislav Kaleta committed Dec 10, 2024
1 parent e343b99 commit a265984
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Cache/KVCacheAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace FluffyDiscord\RoadRunnerBundle\Cache;

use FluffyDiscord\RoadRunnerBundle\Exception\CacheAutoRegisterException;
use FluffyDiscord\RoadRunnerBundle\Exception\SodiumKeypairException;
use FluffyDiscord\RoadRunnerBundle\Exception\SodiumNotEnabledException;
use Spiral\Goridge\RPC\RPCInterface;
Expand All @@ -10,6 +11,7 @@
use Spiral\RoadRunner\KeyValue\Serializer\IgbinarySerializer;
use Spiral\RoadRunner\KeyValue\Serializer\SodiumSerializer;
use Symfony\Component\Cache\Adapter\Psr16Adapter;
use Spiral\RoadRunner\KeyValue\Cache;

class KVCacheAdapter extends Psr16Adapter
{
Expand All @@ -22,6 +24,10 @@ public static function create(
?string $keypairPath,
): self
{
if (!class_exists(Cache::class)) {
throw new CacheAutoRegisterException("Run 'composer require spiral/roadrunner-kv' to enable RoadRunner KV cache");
}

$serializer = null;
if ($serializerClass === null && function_exists("igbinary_serialize")) {
$serializer = new IgbinarySerializer();
Expand Down

0 comments on commit a265984

Please sign in to comment.