Skip to content

Commit 59bce26

Browse files
committed
Refactored Caching
1 parent 5ec4d9b commit 59bce26

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/Telepath.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,10 @@ public function bot(string $name = null): ?TelegramBot
1212
{
1313
$name ??= config('telepath.default');
1414

15-
return static::make($name)
16-
?? throw new \InvalidArgumentException('Invalid bot name provided.');
17-
}
18-
19-
protected function make(string $identifier): ?TelegramBot
20-
{
2115
try {
22-
return app("telepath.bot.{$identifier}");
16+
return app("telepath.bot.{$name}");
2317
} catch (BindingResolutionException) {
24-
return null;
18+
throw new \InvalidArgumentException('Invalid bot name provided.');
2519
}
2620
}
2721

src/TelepathServiceProvider.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Support\Facades\Route;
66
use Illuminate\Support\ServiceProvider;
7+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
78
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
89
use Telepath\Laravel\Config\BotConfig;
910
use Telepath\Laravel\Console\Commands\FetchCommand;
@@ -33,12 +34,6 @@ public function register(): void
3334
container: app(),
3435
);
3536

36-
$bot->enableCaching(
37-
new FilesystemAdapter(
38-
directory: storage_path("telepath/cache/{$config->name}"),
39-
)
40-
);
41-
4237
$bot->discoverPsr4(
4338
$config->directory ?? app_path('Telepath')
4439
);

0 commit comments

Comments
 (0)