summaryrefslogtreecommitdiffstats
path: root/src/pattern.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pattern.go')
-rw-r--r--src/pattern.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/pattern.go b/src/pattern.go
index 05b03b9e..f1caeba2 100644
--- a/src/pattern.go
+++ b/src/pattern.go
@@ -247,27 +247,13 @@ func (p *Pattern) Match(chunk *Chunk, slab *util.Slab) []*Result {
// ChunkCache: Exact match
cacheKey := p.CacheKey()
if p.cacheable {
- if cached, found := _cache.Find(chunk, cacheKey); found {
+ if cached := _cache.Find(chunk, cacheKey); cached != nil {
return cached
}
}
// Prefix/suffix cache
- var space []*Result
-Loop:
- for idx := 1; idx < len(cacheKey); idx++ {
- // [---------| ] | [ |---------]
- // [--------| ] | [ |--------]
- // [-------| ] | [ |-------]
- prefix := cacheKey[:len(cacheKey)-idx]
- suffix := cacheKey[idx:]
- for _, substr := range [2]*string{&prefix, &suffix} {
- if cached, found := _cache.Find(chunk, *substr); found {
- space = cached
- break Loop
- }
- }
- }
+ space := _cache.Search(chunk, cacheKey)
matches := p.matchChunk(chunk, space, slab)