66
77use Illuminate \Cache \TaggableStore ;
88use Illuminate \Contracts \Cache \LockProvider ;
9- use Illuminate \Support \InteractsWithTime ;
109use Spiral \RoadRunner \KeyValue \StorageInterface ;
1110
1211final class RoadRunnerStore extends TaggableStore implements LockProvider
1312{
14- use InteractsWithTime;
15-
1613 public function __construct (private StorageInterface $ storage , private string $ prefix = '' ) {}
1714
1815 public function get ($ key )
@@ -39,7 +36,7 @@ public function many(array $keys)
3936
4037 public function put ($ key , $ value , $ seconds )
4138 {
42- return $ this ->storage ->set ($ this ->prefix . $ key , $ value , $ this -> calculateExpiration ( $ seconds) );
39+ return $ this ->storage ->set ($ this ->prefix . $ key , $ value , $ seconds );
4340 }
4441
4542 public function putMany (array $ values , $ seconds )
@@ -52,7 +49,7 @@ public function putMany(array $values, $seconds)
5249
5350 return $ this ->storage ->setMultiple (
5451 $ prefixedValues ,
55- $ this -> calculateExpiration ( $ seconds) ,
52+ $ seconds ,
5653 );
5754 }
5855
@@ -90,28 +87,4 @@ public function getPrefix()
9087 {
9188 return $ this ->prefix ;
9289 }
93-
94- /**
95- * Set the cache key prefix.
96- */
97- public function setPrefix (string $ prefix ): void
98- {
99- $ this ->prefix = !empty ($ prefix ) ? $ prefix . ': ' : '' ;
100- }
101-
102- /**
103- * Get the expiration time of the key.
104- */
105- protected function calculateExpiration (int $ seconds ): int
106- {
107- return $ this ->toTimestamp ($ seconds );
108- }
109-
110- /**
111- * Get the UNIX timestamp for the given number of seconds.
112- */
113- protected function toTimestamp (int $ seconds ): int
114- {
115- return $ seconds > 0 ? $ this ->availableAt ($ seconds ) : 0 ;
116- }
11790}
0 commit comments