Aho-Corasick automaton working On Redis — distributed multi-pattern matching for Go.
ACOR stores a shared Aho-Corasick pattern dictionary in Redis and exposes it through a Go library and CLI. Multiple application instances can update the same dictionary at runtime while preset engines serve matches from local memory.
Typical uses include content filtering, keyword extraction, intrusion detection, search highlighting, and real-time text classification.
- Shared state — every application instance uses the same Redis-backed dictionary
- Runtime updates — Pub/Sub invalidation, with optional polling for missed messages
- Fast reads — preset engines match locally without Redis I/O on the hot path
- Flexible deployment — standalone Redis, Sentinel, Cluster, Ring, and Valkey
- Complete matching API — occurrences, positions, sets, streams, batches, and parallel matching
ACOR requires Go 1.25 or newer and Redis 3.0 or newer, or Valkey 7.2 or newer.
go get github.com/skyoo2003/acor/pkg/acor@latestStart Redis locally, then create a matcher:
package main
import (
"fmt"
"github.com/skyoo2003/acor/pkg/acor"
)
func main() {
ac, err := acor.Create(&acor.AhoCorasickArgs{
Addr: "localhost:6379",
Name: "sample",
Preset: acor.PresetBalanced,
})
if err != nil {
panic(err)
}
defer ac.Close()
if _, err := ac.AddMany([]string{"he", "her", "him"}, nil); err != nil {
panic(err)
}
matches, err := ac.Find("he is him")
if err != nil {
panic(err)
}
fmt.Println(matches)
}New collections use the optimized V2 Redis schema by default. PresetBalanced
is the recommended starting point when reads should run locally.
| Goal | Preset |
|---|---|
| General-purpose speed and memory | PresetBalanced |
| Highest matching throughput | PresetSpeed |
| Lowest memory usage | PresetMemoryEfficient |
Redis remains the source of truth for every preset. See the preset guide for trade-offs and the Redis-backed engine guide for multi-instance invalidation safety.
Everything past this point lives on the
documentation site: Redis topologies, the matching and
streaming API, batch and parallel guides, the schema-V2 migration and benchmarks, deployment
and troubleshooting, the acor CLI, the experimental server module, and what the v1 line
promises. Package signatures are on
pkg.go.dev.
Contributing · Support · Security · Code of Conduct · Governance · Changelog
Apache License 2.0 — Copyright 2016-2026 Sungkyu Yoo