Skip to content

[WIP] Refactor cache section in tempodb/backend#399

Closed
dgzlopes wants to merge 3 commits intografana:masterfrom
dgzlopes:refactor-tempodb-cache
Closed

[WIP] Refactor cache section in tempodb/backend#399
dgzlopes wants to merge 3 commits intografana:masterfrom
dgzlopes:refactor-tempodb-cache

Conversation

@dgzlopes
Copy link
Copy Markdown
Member

@dgzlopes dgzlopes commented Dec 8, 2020

What this PR does:
TBD

Which issue(s) this PR fixes:
Fixes #373
Fixes #424

Checklist

  • Tests updated ---> Not yet!
  • Documentation added ---> Not yet!
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

cc @annanay25

Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
@annanay25
Copy link
Copy Markdown
Contributor

Great work @dgzlopes! 🎉 I'll take a look tomorrow, but this is definitely in the right direction!

Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
@dgzlopes dgzlopes mentioned this pull request Jan 6, 2021
3 tasks
Copy link
Copy Markdown
Contributor

@annanay25 annanay25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feeling really good about this PR, great work @dgzlopes :)

Let's add the tests and we can land this soon!

Shutdown()
}

func NewCache(nextReader backend.Reader, nextWriter backend.Writer, cache Cache) (backend.Reader, backend.Writer, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought(non-blocking): I think we may run into cyclic dependencies here. In the case that happens, we can change the signature of this function to accept a cfg object instead of Cache.

func NewCache(nextReader backend.Reader, nextWriter backend.Writer, cfg tempodb.Config) (backend.Reader, backend.Writer, error)

@@ -0,0 +1,60 @@
package memcached
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add a memcached_test.go with just a single line:

var _ (cache.Cache) = (*Cache)(nil)

similarly for redis.

TTL time.Duration `yaml:"ttl"`
}

type Cache struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's name this Client. That way when we create the client the signature will be memcache.NewClient()., which also helps reduce confusion. Similarly for Redis.

@dgzlopes
Copy link
Copy Markdown
Member Author

Closing in favor of #485

@dgzlopes dgzlopes closed this Jan 28, 2021
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

Successfully merging this pull request may close these issues.

Delete Disk Cache Refactor cache section in tempodb/backend to use Cache interface

2 participants