Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCachedUserFeeds ¶
GetCachedUserFeeds retrieves user feeds from request cache if available, otherwise fetches from database and stores in cache for subsequent calls. This eliminates duplicate GetUserFeeds calls within a single request.
Example usage in handlers:
feeds, err := middleware.GetCachedUserFeeds(c, userID, db)
func RequestCacheMiddleware ¶
func RequestCacheMiddleware() gin.HandlerFunc
RequestCacheMiddleware creates a new request-scoped cache for each HTTP request. This cache is stored in gin.Context and automatically cleaned up when the request completes.
Types ¶
type RequestCache ¶
type RequestCache struct {
// contains filtered or unexported fields
}
RequestCache provides request-scoped caching to eliminate duplicate database calls within a single HTTP request. Cache is automatically cleared when the request completes.
Click to show internal directories.
Click to hide internal directories.