Skip to content

Commit a7de94a

Browse files
committed
Revert "chore: tweaks at cache middleware"
This reverts commit 12cea6a.
1 parent fa6bb49 commit a7de94a

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

app/Http/Middleware/CacheMiddleware.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function handle($request, Closure $next, $cache_lifetime, $cache_region =
9494

9595
if ($regionTag) {
9696
Log::debug("CacheMiddleware: using region tag {$regionTag} ip {$ip} agent {$agent}");
97-
// try L1
97+
// try L1 APC
9898
$encoded = MemCache::get($key);
9999
$wasMemCacheHit = $encoded !== null;
100100
if($wasMemCacheHit){
@@ -124,14 +124,14 @@ public function handle($request, Closure $next, $cache_lifetime, $cache_region =
124124
});
125125

126126

127-
// backfill Memcache only if we actually have a value
127+
// backfill APC only if we actually have a value
128128
if ($encoded !== null) { // avoid null writes
129129
MemCache::put($key, $encoded, $cache_lifetime, $regionTag);
130130
}
131131
}
132132
$data = $this->decode($encoded);
133133
} else {
134-
// try L1
134+
// try L1 APC
135135
$encoded = MemCache::get($key);
136136
$wasMemCacheHit = !is_null($encoded);
137137
if($wasMemCacheHit){
@@ -157,7 +157,7 @@ public function handle($request, Closure $next, $cache_lifetime, $cache_region =
157157
}
158158
return Cache::get($key);
159159
});
160-
// store at MemCache
160+
// store at APC
161161
if ($encoded !== null) { // avoid null writes
162162
MemCache::put($key, $encoded, $cache_lifetime);
163163
}
@@ -177,8 +177,7 @@ public function handle($request, Closure $next, $cache_lifetime, $cache_region =
177177
$response->headers->addCacheControlDirective('must-revalidate', true);
178178
$response->headers->addCacheControlDirective('proxy-revalidate', true);
179179
$response->headers->add([
180-
'X-Cache-Result' => ($wasMemCacheHit || $wasHit) ? 'HIT' : 'MISS',
181-
'X-Cache-Type' => $wasMemCacheHit ? 'M' : ($wasHit ? 'R' : 'N'),
180+
'X-Cache-Result' => $wasMemCacheHit ? 'HIT MemcCache' : ($wasHit ? 'HIT REDIS' : 'MISS'),
182181
]);
183182
Log::debug( "CacheMiddleware: returning response", [
184183
'ip' => $ip,

0 commit comments

Comments
 (0)