File tree Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -528,15 +528,10 @@ func (h *hubBase) cacheTTL(connectionName string) time.Duration {
528528 }
529529 log .Printf ("[INFO] cacheTTL 2" )
530530
531- var ttl time.Duration
531+ const defaultTtl = 300 * time .Second
532532
533- // would this give data earlier than the cacheClearTime
534- now := time .Now ()
535- if now .Add (- ttl ).Before (h .cacheSettings .ClearTime ) {
536- ttl = now .Sub (h .cacheSettings .ClearTime )
537- }
538- log .Printf ("[INFO] cacheTTL 5" )
539- return ttl
533+ log .Printf ("[INFO] default cacheTTL %v" , defaultTtl )
534+ return defaultTtl
540535}
541536
542537// GetSortableFields
Original file line number Diff line number Diff line change @@ -286,12 +286,15 @@ func (h *RemoteHub) clearConnectionCache(connection string) error {
286286func (h * RemoteHub ) cacheEnabled (connectionName string ) bool {
287287 // if the caching is disabled for the server, just return false
288288 if ! h .cacheSettings .ServerCacheEnabled {
289+ log .Printf ("[INFO] cacheEnabled returning false since server cache is disabled" )
289290 return false
290291 }
291292
292293 if h .cacheSettings .ClientCacheEnabled != nil {
294+ log .Printf ("[INFO] cacheEnabled returning %v since client cache is enabled" , * h .cacheSettings .ClientCacheEnabled )
293295 return * h .cacheSettings .ClientCacheEnabled
294296 }
297+ log .Printf ("[INFO] default cacheEnabled returning true" )
295298
296299 return true
297300}
@@ -302,14 +305,11 @@ func (h *RemoteHub) cacheTTL(connectionName string) time.Duration {
302305 return * h .cacheSettings .Ttl
303306 }
304307
305- var ttl time.Duration
308+ // default ttl is 300 secs
309+ const defaultTTL = 300 * time .Second
306310
307- // would this give data earlier than the cacheClearTime
308- now := time .Now ()
309- if now .Add (- ttl ).Before (h .cacheSettings .ClearTime ) {
310- ttl = now .Sub (h .cacheSettings .ClearTime )
311- }
312- return ttl
311+ log .Printf ("[INFO] default cacheTTL returning %v" , defaultTTL )
312+ return defaultTTL
313313}
314314
315315// resolve the server cache enabled property
You can’t perform that action at this time.
0 commit comments