From ca9a7cbcf31c9af179443e6035fe81908bffeab3 Mon Sep 17 00:00:00 2001 From: pankona Date: Fri, 3 Jun 2022 20:45:17 +0900 Subject: [PATCH] fix typos --- TRACE.md | 2 +- dataloader.go | 8 ++++---- example/lru_cache/golang_lru_test.go | 4 ++-- example/no_cache/no_cache_test.go | 2 +- example/ttl_cache/go_cache_test.go | 4 ++-- in_memory_cache.go | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/TRACE.md b/TRACE.md index 5c05848..ea43760 100644 --- a/TRACE.md +++ b/TRACE.md @@ -1,6 +1,6 @@ # Adding a new trace backend. -If you whant to add a new tracing backend all you need to do is implement the +If you want to add a new tracing backend all you need to do is implement the `Tracer` interface and pass it as an option to the dataloader on initialization. As an example, this is how you could implement it to an OpenCensus backend. diff --git a/dataloader.go b/dataloader.go index ecb940a..3c3a5ce 100644 --- a/dataloader.go +++ b/dataloader.go @@ -1,4 +1,4 @@ -// Package dataloader is an implimentation of facebook's dataloader in go. +// Package dataloader is an implementation of facebook's dataloader in go. // See https://github.com/facebook/dataloader for more information package dataloader @@ -242,7 +242,7 @@ func (l *Loader[K, V]) Load(originalContext context.Context, key K) Thunk[V] { l.cache.Set(ctx, key, thunk) l.cacheLock.Unlock() - // this is sent to batch fn. It contains the key and the channel to return the + // this is sent to batch fn. It contains the key and the channel to return // the result on req := &batchRequest[K, V]{key, c} @@ -279,7 +279,7 @@ func (l *Loader[K, V]) Load(originalContext context.Context, key K) Thunk[V] { return thunk } -// LoadMany loads mulitiple keys, returning a thunk (type: ThunkMany) that will resolve the keys passed in. +// LoadMany loads multiple keys, returning a thunk (type: ThunkMany) that will resolve the keys passed in. func (l *Loader[K, V]) LoadMany(originalContext context.Context, keys []K) ThunkMany[V] { ctx, finish := l.tracer.TraceLoadMany(originalContext, keys) @@ -347,7 +347,7 @@ func (l *Loader[K, V]) LoadMany(originalContext context.Context, keys []K) Thunk return thunkMany } -// Clear clears the value at `key` from the cache, it it exsits. Returs self for method chaining +// Clear clears the value at `key` from the cache, it it exists. Returns self for method chaining func (l *Loader[K, V]) Clear(ctx context.Context, key K) Interface[K, V] { l.cacheLock.Lock() l.cache.Delete(ctx, key) diff --git a/example/lru_cache/golang_lru_test.go b/example/lru_cache/golang_lru_test.go index 9b2caf5..fae064e 100644 --- a/example/lru_cache/golang_lru_test.go +++ b/example/lru_cache/golang_lru_test.go @@ -38,7 +38,7 @@ func (c *cache[K, V]) Delete(_ context.Context, key K) bool { return false } -// Clear cleasrs the cache +// Clear clears the cache func (c *cache[K, V]) Clear() { c.ARCCache.Purge() } @@ -64,7 +64,7 @@ func ExampleGolangLRU() { return results } - // go-cache will automaticlly cleanup expired items on given duration. + // go-cache will automatically cleanup expired items on given duration. c, _ := lru.NewARC(100) cache := &cache[int, *User]{ARCCache: c} loader := dataloader.NewBatchedLoader(batchFunc, dataloader.WithCache[int, *User](cache)) diff --git a/example/no_cache/no_cache_test.go b/example/no_cache/no_cache_test.go index 15f167c..67c0c0c 100644 --- a/example/no_cache/no_cache_test.go +++ b/example/no_cache/no_cache_test.go @@ -28,7 +28,7 @@ func ExampleNoCache() { return results } - // go-cache will automaticlly cleanup expired items on given diration + // go-cache will automatically cleanup expired items on given duration cache := &dataloader.NoCache[int, *User]{} loader := dataloader.NewBatchedLoader(batchFunc, dataloader.WithCache[int, *User](cache)) diff --git a/example/ttl_cache/go_cache_test.go b/example/ttl_cache/go_cache_test.go index 4b369b3..5905b62 100644 --- a/example/ttl_cache/go_cache_test.go +++ b/example/ttl_cache/go_cache_test.go @@ -1,4 +1,4 @@ -// package ttl_cache_test contains an exmaple of using go-cache as a long term cache solution for dataloader. +// package ttl_cache_test contains an example of using go-cache as a long term cache solution for dataloader. package ttl_cache_test import ( @@ -68,7 +68,7 @@ func ExampleTTLCache() { return results } - // go-cache will automaticlly cleanup expired items on given diration + // go-cache will automatically cleanup expired items on given duration c := cache.New(15*time.Minute, 15*time.Minute) cache := &Cache[int, *User]{c} loader := dataloader.NewBatchedLoader(batchFunc, dataloader.WithCache[int, *User](cache)) diff --git a/in_memory_cache.go b/in_memory_cache.go index 354cece..37f33d1 100644 --- a/in_memory_cache.go +++ b/in_memory_cache.go @@ -30,7 +30,7 @@ func (c *InMemoryCache[K, V]) Set(_ context.Context, key K, value Thunk[V]) { c.mu.Unlock() } -// Get gets the value at `key` if it exsits, returns value (or nil) and bool +// Get gets the value at `key` if it exists, returns value (or nil) and bool // indicating of value was found func (c *InMemoryCache[K, V]) Get(_ context.Context, key K) (Thunk[V], bool) { c.mu.RLock()