-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStorageFactory.php
More file actions
21 lines (18 loc) · 811 Bytes
/
StorageFactory.php
File metadata and controls
21 lines (18 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
namespace Slowmove\SimplePhpQueue\Storage;
use Slowmove\SimplePhpQueue\Storage\Adapters\BeanstalkdStorage;
use Slowmove\SimplePhpQueue\Storage\Adapters\FileStorage;
use Slowmove\SimplePhpQueue\Storage\Adapters\RedisStorage;
use Slowmove\SimplePhpQueue\Storage\Adapters\SqliteStorage;
class StorageFactory
{
public static function getStorage(StorageType $type, string $storagePath = "", string $storageName = 'queue'): StorageInterface
{
return match ($type) {
StorageType::FILE => new FileStorage($storagePath, $storageName),
StorageType::SQLITE => new SqliteStorage($storagePath, $storageName),
StorageType::REDIS => new RedisStorage($storagePath, $storageName),
StorageType::BEANSTALKD => new BeanstalkdStorage($storagePath, $storageName),
};
}
}