Skip to content

Commit

Permalink
Don't use partial name matching
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Apr 21, 2014
1 parent b80888a commit 44edc7e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions R/cache.r
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
new_cache <- function() {

cache <- NULL
cache_reset <- function() {
cache <<- new.env(TRUE, emptyenv())
}

cache_set <- function(key, value) {
assign(key, value, env = cache)
assign(key, value, envir = cache)
}

cache_get <- function(key) {
get(key, env = cache, inherits = FALSE)
get(key, envir = cache, inherits = FALSE)
}

cache_has_key <- function(key) {
exists(key, env = cache, inherits = FALSE)
exists(key, envir = cache, inherits = FALSE)
}

cache_reset()
list(
reset = cache_reset,
set = cache_set,
reset = cache_reset,
set = cache_set,
get = cache_get,
has_key = cache_has_key,
keys = function() ls(cache)
)
}
}

0 comments on commit 44edc7e

Please sign in to comment.