mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
WIP
This commit is contained in:
28
R/cache.R
28
R/cache.R
@@ -95,6 +95,8 @@ DiskCache <- R6Class("DiskCache",
|
||||
private$prune_ <- list(prune)
|
||||
},
|
||||
|
||||
# TODO: Should call has() and return some sentinal object if not present
|
||||
# Should be atomic ot avoid race conditions.
|
||||
get = function(key) {
|
||||
if (!self$has(key)) {
|
||||
stop("Key not available: ", key)
|
||||
@@ -104,6 +106,12 @@ DiskCache <- R6Class("DiskCache",
|
||||
value
|
||||
},
|
||||
|
||||
mget = function(keys) {
|
||||
},
|
||||
|
||||
mset = function(..., .list = NULL) {
|
||||
},
|
||||
|
||||
set = function(key, value) {
|
||||
# TODO: Make sure key is a safe string
|
||||
self$prune()
|
||||
@@ -115,6 +123,11 @@ DiskCache <- R6Class("DiskCache",
|
||||
file.exists(private$key_to_filename(key))
|
||||
},
|
||||
|
||||
# Return all keys in the cache
|
||||
keys = function() {
|
||||
|
||||
},
|
||||
|
||||
remove = function(key) {
|
||||
file.remove(private$key_to_filename(key))
|
||||
invisible(self)
|
||||
@@ -130,6 +143,14 @@ DiskCache <- R6Class("DiskCache",
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
size = function() {
|
||||
},
|
||||
|
||||
# Resets the cache and destroys the containing folder so that no
|
||||
# one else who shares the data back end can use it anymore.
|
||||
destroy = function() {
|
||||
},
|
||||
|
||||
finalize = function() {
|
||||
if (private$reset_on_finalize) {
|
||||
self$reset()
|
||||
@@ -154,6 +175,13 @@ DiskCache <- R6Class("DiskCache",
|
||||
)
|
||||
)
|
||||
|
||||
# Safely hash an object. If it has any weird things in it that might change, like
|
||||
# functions or xptrs (?), throw an error.
|
||||
safe_hash <- function(x) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
disk_pruner <- function(max_size = 5 * 1024^2, max_age = Inf,
|
||||
discard = c("oldest", "newest"),
|
||||
timetype = c("ctime", "atime", "mtime"))
|
||||
|
||||
Reference in New Issue
Block a user