Refactor: Update the cache getter function (#7800)

Rename the cache getter function to reflect the true functionality of retrieving with
TTL consideration.

Refs: https://github.com/coredns/coredns/issues/6505

Signed-off-by: Raisa Kabir <raisa.kabir2010@gmail.com>
This commit is contained in:
Raisa Kabir
2026-01-05 22:24:04 +06:00
committed by GitHub
parent 6dca5b26d1
commit adba778626
2 changed files with 6 additions and 5 deletions

View File

@@ -295,7 +295,7 @@ func TestCacheInsertion(t *testing.T) {
}
// Attempt to retrieve cache entry
i := c.getIgnoreTTL(time.Now().UTC(), state, "dns://:53")
i := c.getIfNotStale(time.Now().UTC(), state, "dns://:53")
found := i != nil
if !tc.shouldCache && found {
@@ -879,7 +879,7 @@ func TestCacheSeparation(t *testing.T) {
m = cacheMsg(m, tc.query)
state = request.Request{W: &test.ResponseWriter{}, Req: m}
item := c.getIgnoreTTL(time.Now().UTC(), state, "dns://:53")
item := c.getIfNotStale(time.Now().UTC(), state, "dns://:53")
found := item != nil
if !tc.expectCached && found {