Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

215 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ACOR

Aho-Corasick automaton working On Redis — distributed multi-pattern matching for Go.

Current Release CI Status Docs Go Reference License Sponsor

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.

Highlights

  • 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

Installation

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@latest

Quick Start

Start 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.

Choosing a Preset

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.

Documentation

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.

Project

Contributing · Support · Security · Code of Conduct · Governance · Changelog

License

Apache License 2.0 — Copyright 2016-2026 Sungkyu Yoo

About

Aho-Corasick automaton working On Redis/Valkey

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages