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

LRU Cache and Timed Cache avoiding GIL a in memory cache solution #60

Open
7 tasks
cirospaciari opened this issue Jan 3, 2023 · 0 comments
Open
7 tasks
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@cirospaciari
Copy link
Owner

Add cache options, LRU with maxsize or Cache with duration. When cached headers, status code and body should be cached on C++ and never touch Python again when cached.

Should be implemented after the router decorator: #59

from socketify import App
app = App()
router = app.router()

@router.get("/lru", lru_cache=128) #If LRU True default value is set (128)
def lru(res, req):
   res.end("Hello World!")

router = app.router(lru_cache=128)
@router.get("/lru_2") #If LRU is passed on router, so any route of this router is cached with lru
def lru2(res, req):
   res.end("Hello World!")

@router.get("/cache", cache=30) #If cache is provided the expiration will be in seconds (30s in this cache)
def cache2(res, req):
   res.end("Hello World!")


router = app.router(cache=30, cache_ignores_query=True) # cache_ignores_query default is False
@router.get("/cache2") #If Cache is passed on router, so any route of this router is cached with cache
def cache2(res, req):
   res.end("Hello World!")
   
 # cache, lru_cache and cache_ignores_query should be available in the app router and MiddlewareRouter too
app.get("/test", lambda res, req: res.end("xablau"), cache=30)

Cache should synchronize all requests (only 1 request should be processed at a time, all other requests are queued and responded to with the cached content)
Cache should use URL or fullurl and be route independent (get/post/any etc)

  • Create LRU Cache system using C++
  • Create Timed Cache System using C++ and libuv
  • Support cache_ignores_query in LRU and Timed Cache
  • Support cache helper in the default Router
  • Support cache helper in MiddlewareRouter
  • Support cache helper in decorator routers
  • Create Documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant