File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 2727 ],
2828 "require" : {
2929 "php" : " >=8.1" ,
30+ "amphp/cache" : " ^2" ,
3031 "amphp/http-server" : " ^3" ,
3132 "amphp/http" : " ^2-dev" ,
3233 "amphp/socket" : " ^2" ,
33- "nikic/fast-route" : " ^1" ,
34- "cash/lrucache" : " ^1"
34+ "nikic/fast-route" : " ^1"
3535 },
3636 "require-dev" : {
3737 "amphp/log" : " ^2" ,
Original file line number Diff line number Diff line change 22
33namespace Amp \Http \Server ;
44
5+ use Amp \Cache \LocalCache ;
56use Amp \Http \HttpStatus ;
67use Amp \Http \Server \RequestHandler \ClosureRequestHandler ;
7- use cash \LRUCache ;
88use FastRoute \Dispatcher ;
99use FastRoute \RouteCollector ;
1010use function FastRoute \simpleDispatcher ;
@@ -27,7 +27,7 @@ final class Router implements RequestHandler
2727
2828 private string $ prefix = "/ " ;
2929
30- private readonly LRUCache $ cache ;
30+ private readonly LocalCache $ cache ;
3131
3232 /**
3333 * @param int $cacheSize Maximum number of route matches to cache.
@@ -46,7 +46,7 @@ public function __construct(
4646 throw new \ValueError ("The number of cache entries must be greater than zero " );
4747 }
4848
49- $ this ->cache = new LRUCache ($ cacheSize );
49+ $ this ->cache = new LocalCache ($ cacheSize );
5050 }
5151
5252 /**
@@ -61,7 +61,7 @@ public function handleRequest(Request $request): Response
6161
6262 if (null === $ match = $ this ->cache ->get ($ toMatch )) {
6363 $ match = $ this ->routeDispatcher ->dispatch ($ method , $ path );
64- $ this ->cache ->put ($ toMatch , $ match );
64+ $ this ->cache ->set ($ toMatch , $ match );
6565 }
6666
6767 switch ($ match [0 ]) {
You can’t perform that action at this time.
0 commit comments