Something went wrong. Try again.
Build Reactive Signals for Bluesky's AT Protocol Firehose in Laravel
Something went wrong. Try again.
867 B · 35 lines
PHP
at dev
123456789101112131415161718192021222324252627282930313233343536<?php
namespace SocialDept\AtpSignals\Storage;
use Illuminate\Support\Facades\Redis;use SocialDept\AtpSignals\Contracts\CursorStore;
class RedisCursorStore implements CursorStore{ protected string $connection; protected string $key;
public function __construct() { $this->connection = config('signal.cursor_config.redis.connection', 'default'); $this->key = config('signal.cursor_config.redis.key', 'signal:cursor'); }
public function get(): ?int { $cursor = Redis::connection($this->connection)->get($this->key);
return $cursor ? (int) $cursor : null; }
public function set(int $cursor): void { Redis::connection($this->connection)->set($this->key, $cursor); }
public function clear(): void { Redis::connection($this->connection)->del($this->key); }}