Loading documentation...
Loading documentation...
Loading documentation...
This guide will help you install and set up Synapse in your Go project.
Before installing Synapse, ensure you have:
go mod init if needed)Use go get to install Synapse:
go get github.com/kolosys/synapseThis will download the package and add it to your go.mod file.
Synapse includes several packages that you can import based on your needs:
The main cache functionality:
import "github.com/kolosys/synapse"Built-in similarity algorithms for string and vector comparisons:
import "github.com/kolosys/synapse/algorithms"Provides:
Levenshtein - Edit distance for stringsDamerauLevenshtein - Edit distance with transpositionsHamming / HammingBytes - Hamming distance for equal-length strings/bytesEuclidean - Euclidean distance for vectorsManhattan - Manhattan distance for vectorsCache eviction policies:
import "github.com/kolosys/synapse/eviction"Provides:
LRU - Least Recently Used evictionCombinedPolicy - Combine multiple policies with weighted scoringCreate a simple test file to verify the installation:
package main
import (
"context"
"fmt"
"github.com/kolosys/synapse"
)
func main() {
cache := synapse.New[string, string]()
ctx := context.Background()
cache.Set(ctx, "hello", "world")
if value, found := cache.Get(ctx, "hello"); found {
fmt.Println("Synapse installed successfully:", value)
}
}Run the test:
go run main.goTo update to the latest version:
go get -u github.com/kolosys/synapseTo update to a specific version:
go get github.com/kolosys/synapse@v1.2.3If you want to contribute or modify the library:
git clone https://github.com/kolosys/synapse.git
cd synapse
go mod download
go test -race ./...If you encounter a "module not found" error:
GOPATH is set correctlygo clean -modcache and reinstallFor private repositories, configure Git to use SSH or a personal access token:
git config --global url."git@github.com:".insteadOf "https://github.com/"Or set up GOPRIVATE:
export GOPRIVATE=github.com/kolosys/*This guide will help you install and set up Synapse in your Go project.
Before installing Synapse, ensure you have:
go mod init if needed)Use go get to install Synapse:
go get github.com/kolosys/synapseThis will download the package and add it to your go.mod file.
Synapse includes several packages that you can import based on your needs:
The main cache functionality:
import "github.com/kolosys/synapse"Built-in similarity algorithms for string and vector comparisons:
import "github.com/kolosys/synapse/algorithms"Provides:
Levenshtein - Edit distance for stringsDamerauLevenshtein - Edit distance with transpositionsHamming / HammingBytes - Hamming distance for equal-length strings/bytesEuclidean - Euclidean distance for vectorsManhattan - Manhattan distance for vectorsCache eviction policies:
import "github.com/kolosys/synapse/eviction"Provides:
LRU - Least Recently Used evictionCombinedPolicy - Combine multiple policies with weighted scoringCreate a simple test file to verify the installation:
package main
import (
"context"
"fmt"
"github.com/kolosys/synapse"
)
func main() {
cache := synapse.New[string, string]()
ctx := context.Background()
cache.Set(ctx, "hello", "world")
if value, found := cache.Get(ctx, "hello"); found {
fmt.Println("Synapse installed successfully:", value)
}
}Run the test:
go run main.goTo update to the latest version:
go get -u github.com/kolosys/synapseTo update to a specific version:
go get github.com/kolosys/synapse@v1.2.3If you want to contribute or modify the library:
git clone https://github.com/kolosys/synapse.git
cd synapse
go mod download
go test -race ./...If you encounter a "module not found" error:
GOPATH is set correctlygo clean -modcache and reinstallFor private repositories, configure Git to use SSH or a personal access token:
git config --global url."git@github.com:".insteadOf "https://github.com/"Or set up GOPRIVATE:
export GOPRIVATE=github.com/kolosys/*go get github.com/kolosys/synapseimport "github.com/kolosys/synapse"import "github.com/kolosys/synapse/algorithms"import "github.com/kolosys/synapse/eviction"package main
import (
"context"
"fmt"
"github.com/kolosys/synapse"
)
func main() {
cache := synapse.New[string, string]()
ctx := context.Background()
cache.Set(ctx, "hello", "world")
if value, found := cache.Get(ctx, "hello"); found {
fmt.Println("Synapse installed successfully:", value)
}
}go run main.gogo get -u github.com/kolosys/synapsego get github.com/kolosys/synapse@v1.2.3git clone https://github.com/kolosys/synapse.git
cd synapse
go mod download
go test -race ./...git config --global url."git@github.com:".insteadOf "https://github.com/"export GOPRIVATE=github.com/kolosys/*go get github.com/kolosys/synapseimport "github.com/kolosys/synapse"import "github.com/kolosys/synapse/algorithms"import "github.com/kolosys/synapse/eviction"package main
import (
"context"
"fmt"
"github.com/kolosys/synapse"
)
func main() {
cache := synapse.New[string, string]()
ctx := context.Background()
cache.Set(ctx, "hello", "world")
if value, found := cache.Get(ctx, "hello"); found {
fmt.Println("Synapse installed successfully:", value)
}
}go run main.gogo get -u github.com/kolosys/synapsego get github.com/kolosys/synapse@v1.2.3git clone https://github.com/kolosys/synapse.git
cd synapse
go mod download
go test -race ./...git config --global url."git@github.com:".insteadOf "https://github.com/"export GOPRIVATE=github.com/kolosys/*