The ProvideGet pattern allows you to attempt to retrieve a value from the cache, and if it doesn't exist, execute a callback function to fetch/generate the data and automatically store it in the cache with the specified expiration. This is useful for reducing database load (the 'cache aside' pattern).
// If "user:123" is missing, the callback runs, and the result is cached for 30 minutes
userData, exists := zcache.ProvideGet("user:123", func() (interface{}, bool) {
// Simulate database fetch
user := map[string]interface{}{"id": 123, "name": "ZhangSan"}
return user, true
}, time.Minute*30)