File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 11<?php
22namespace Neuron \Mvc \Cache \Storage ;
33
4+ use Neuron \Log \Log ;
45use Neuron \Mvc \Cache \Exceptions \CacheException ;
56
67class FileCacheStorage implements ICacheStorage
@@ -29,6 +30,7 @@ public function read( string $Key ): ?string
2930 {
3031 if ( $ this ->isExpired ( $ Key ) )
3132 {
33+ Log::debug ( "Cache entry expired for key: $ Key " );
3234 $ this ->delete ( $ Key );
3335 return null ;
3436 }
Original file line number Diff line number Diff line change 11<?php
22namespace Neuron \Mvc \Cache ;
33
4+ use Neuron \Log \Log ;
45use Neuron \Mvc \Cache \Exceptions \CacheException ;
56use Neuron \Mvc \Cache \Storage \ICacheStorage ;
67
@@ -40,7 +41,17 @@ public function get( string $Key ): ?string
4041 return null ;
4142 }
4243
43- return $ this ->_Storage ->read ( $ Key );
44+ $ Data = $ this ->_Storage ->read ( $ Key );
45+
46+ if ( !$ Data )
47+ {
48+ Log::debug ( "Cache miss for key: $ Key " );
49+ return null ;
50+ }
51+
52+ Log::debug ( "Cache hit for key: $ Key " );
53+
54+ return $ Data ;
4455 }
4556
4657 /**
@@ -205,4 +216,4 @@ private function shouldRunGc(): bool
205216 // Roll the dice
206217 return mt_rand ( 1 , $ Divisor ) <= ( $ Probability * $ Divisor );
207218 }
208- }
219+ }
You can’t perform that action at this time.
0 commit comments