Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example from cmd/server does not work as expected #71

Open
ashumkin opened this issue Aug 1, 2024 · 1 comment
Open

Example from cmd/server does not work as expected #71

ashumkin opened this issue Aug 1, 2024 · 1 comment

Comments

@ashumkin
Copy link

ashumkin commented Aug 1, 2024

I run

go run  cmd/server/main.go

server starts, outputs

Running...

Then I run

curl 'localhost:8081/set?key=a&value=1'

server outputs

Set: [a]1

then I run

curl 'localhost:8081/cache?key=a'

server outputs

Fetching value for key 'a'

curl hangs for a while then outputs

context deadline exceeded

I expect server will output the value 1 set for the key a

@ashumkin
Copy link
Author

ashumkin commented Aug 1, 2024

Also, the same code (with removed expiration time on the line 27 ) works well with the original golang/groupcache package

$ curl 'localhost:8081/set?key=a&value=1' -i
HTTP/1.1 200 OK
Date: Thu, 01 Aug 2024 16:46:31 GMT
Content-Length: 0

$ curl 'localhost:8081/cache?key=a' -i
HTTP/1.1 200 OK
Date: Thu, 01 Aug 2024 16:46:33 GMT
Content-Length: 2
Content-Type: text/plain; charset=utf-8

1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant