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

Refactor cache into middleware #17

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

toshinari123
Copy link
Contributor

No description provided.

@toshinari123
Copy link
Contributor Author

refer to toshinari123#1

@toshinari123
Copy link
Contributor Author

https://stackoverflow.com/questions/70176881/creating-a-github-pull-request-and-branch-based-on-another-pull-request-and-b

according to this github will automatically make the toshinari123#1 PR to oursky main after #15 is merged

@toshinari123
Copy link
Contributor Author

passed contentcache_test and cache_test

Copy link
Collaborator

@kiootic kiootic left a comment

Choose a reason for hiding this comment

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

Please also rebase on main branch and cleanup the commit history.

internal/cache/contentcache.go Outdated Show resolved Hide resolved
internal/cache/contentcache.go Outdated Show resolved Hide resolved
internal/cache/contentcache.go Outdated Show resolved Hide resolved
internal/handler/site/context/context.go Outdated Show resolved Hide resolved
internal/handler/site/middleware.go Show resolved Hide resolved
internal/handler/site/middleware/cache.go Outdated Show resolved Hide resolved
internal/handler/site/middleware/cache.go Outdated Show resolved Hide resolved
model type ContentCache

model type ContentCache (real)

corrected type ContentCache

write func NewContentCache

write func getContent
Fix contentcache implementation
Instead of storing key and value as value, use a reference-counted map of rwmutexes (it automatically deletes mutexes so no need onExit in Ristretto)

Separated into getContent and setContent in order to allow getContent call without io.ReadSeeker

Used generics
used context as a receiver to pass a reference of contentcache
in order to fix import cycle
in order to fix import cycle in canon.go

Fix canon.go

Fix handler.go and site_handler.go

Fix serve.go
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.

2 participants