server: Add global LRU for routes with keys being the appname + path (#472)

* Add global lru for routes with keys being the appname + path

* minor comment fixes

* remove duplicate entires from THIRD_PARTY

* Make sure that we lock and unlock on get, refresh and delete on the cache
This commit is contained in:
Seif Lotfy سيف لطفي
2017-01-05 19:08:46 +01:00
committed by C Cirello
parent b8d01817b8
commit 6f8e94629f
11 changed files with 193 additions and 59 deletions

View File

@@ -130,6 +130,9 @@ func (s *Server) handleRequest(c *gin.Context, enqueue models.Enqueue) {
}
func (s *Server) loadroutes(ctx context.Context, filter models.RouteFilter) ([]*models.Route, error) {
if route, ok := s.cacheget(filter.AppName, filter.Path); ok {
return []*models.Route{route}, nil
}
resp, err := s.singleflight.do(
filter,
func() (interface{}, error) {