Skip to content

Commit beedcd5

Browse files
author
Nick Randall
committed
fixing examples
1 parent aa342df commit beedcd5

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# DataLoader
2-
[![GoDoc](https://godoc.org/github.com/nicksrandall/dataloader?status.svg)](https://godoc.org/github.com/nicksrandall/dataloader)
2+
[![GoDoc](https://godoc.org/gopkg.in/nicksrandall/dataloader.v3?status.svg)](https://godoc.org/github.com/nicksrandall/dataloader)
33
[![Build Status](https://travis-ci.org/nicksrandall/dataloader.svg?branch=master)](https://travis-ci.org/nicksrandall/dataloader)
44
[![codecov](https://codecov.io/gh/nicksrandall/dataloader/branch/master/graph/badge.svg)](https://codecov.io/gh/nicksrandall/dataloader)
55

@@ -9,7 +9,7 @@ This is an implementation of [Facebook's DataLoader](https://github.com/facebook
99
This project is a work in progress. Feedback is encouraged.
1010

1111
## Install
12-
`go get -u gopkg.in/nicksrandall/dataloader.v2`
12+
`go get -u gopkg.in/nicksrandall/dataloader.v3`
1313

1414
## Usage
1515
```go

example/lru-cache/golang-lru.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Cache struct {
1616
}
1717

1818
// Get gets an item from the cache
19-
func (c *Cache) Get(key string) (dataloader.Thunk, bool) {
19+
func (c *Cache) Get(_ context.Context, key string) (dataloader.Thunk, bool) {
2020
v, ok := c.ARCCache.Get(key)
2121
if ok {
2222
return v.(dataloader.Thunk), ok
@@ -25,12 +25,12 @@ func (c *Cache) Get(key string) (dataloader.Thunk, bool) {
2525
}
2626

2727
// Set sets an item in the cache
28-
func (c *Cache) Set(key string, value dataloader.Thunk) {
28+
func (c *Cache) Set(_ context.Context, key string, value dataloader.Thunk) {
2929
c.ARCCache.Add(key, value)
3030
}
3131

3232
// Delete deletes an item in the cache
33-
func (c *Cache) Delete(key string) bool {
33+
func (c *Cache) Delete(_ context.Context, key string) bool {
3434
if c.ARCCache.Contains(key) {
3535
c.ARCCache.Remove(key)
3636
return true

example/ttl-cache/go-cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Cache struct {
1717
}
1818

1919
// Get gets a value from the cache
20-
func (c *Cache) Get(key string) (dataloader.Thunk, bool) {
20+
func (c *Cache) Get(_ context.Context, key string) (dataloader.Thunk, bool) {
2121
v, ok := c.c.Get(key)
2222
if ok {
2323
return v.(dataloader.Thunk), ok
@@ -26,12 +26,12 @@ func (c *Cache) Get(key string) (dataloader.Thunk, bool) {
2626
}
2727

2828
// Set sets a value in the cache
29-
func (c *Cache) Set(key string, value dataloader.Thunk) {
29+
func (c *Cache) Set(_ context.Context, key string, value dataloader.Thunk) {
3030
c.c.Set(key, value, 0)
3131
}
3232

3333
// Delete deletes and item in the cache
34-
func (c *Cache) Delete(key string) bool {
34+
func (c *Cache) Delete(_ context.Context, key string) bool {
3535
if _, found := c.c.Get(key); found {
3636
c.c.Delete(key)
3737
return true

0 commit comments

Comments
 (0)