nathan-russell/hashmap

Set attributes for uncached calls to data

nathan-russell opened this issue · 0 comments

Most likely needs to happen before coercion.

library(hashmap)

x <- Sys.Date() + 1:5
y <- Sys.Date() + 1:5
h <- hashmap(x, y)

h$data()
#        16911        16910        16912        16909        16908 
# "2016-04-20" "2016-04-19" "2016-04-21" "2016-04-18" "2016-04-17"

h$cache_keys()
h$cache_values()

h$data()
#   2016-04-20   2016-04-19   2016-04-21   2016-04-18   2016-04-17 
# "2016-04-20" "2016-04-19" "2016-04-21" "2016-04-18" "2016-04-17"

##
##
x <- Sys.time() + 3600 * (1:5)
y <- Sys.time() + 3600 * (1:5)
h <- hashmap(x, y)

h$data()
#          1460841642.22724          1460834442.22724          1460838042.22724 
# "2016-04-16 21:20:52 UTC" "2016-04-16 19:20:52 UTC" "2016-04-16 20:20:52 UTC" 
#          1460830842.22724          1460827242.22724 
# "2016-04-16 18:20:52 UTC" "2016-04-16 17:20:52 UTC"  

h$cache_keys()
h$cache_values()

h$data()
#       2016-04-16 21:20:42       2016-04-16 19:20:42       2016-04-16 20:20:42 
# "2016-04-16 21:20:52 UTC" "2016-04-16 19:20:52 UTC" "2016-04-16 20:20:52 UTC" 
#       2016-04-16 18:20:42       2016-04-16 17:20:42 
# "2016-04-16 18:20:52 UTC" "2016-04-16 17:20:52 UTC"