Skip to content

Commit 51a4544

Browse files
committed
Add to do and additional cache types.
1 parent e3569a6 commit 51a4544

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Encoding: UTF-8
2-
Package: memoise2
2+
Package: xmemoise
33
Title: Memoisation of Functions
44
Version: 1.0.0.9000
55
Authors@R: c(

README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
# memoise [![Travis-CI Build Status](https://travis-ci.org/hadley/memoise.svg?branch=master)](https://travis-ci.org/hadley/memoise) [![Coverage Status](https://img.shields.io/codecov/c/github/hadley/memoise/master.svg)](https://codecov.io/github/hadley/memoise?branch=master)
1+
# xmemoise
22

3+
Forked from [hadley/memoise](https://github.com/hadley/memoise)
4+
5+
# Installation
6+
7+
```
8+
devtools::install_github("danielecook/xmemoise")
9+
```
10+
11+
# Memoization
312

413
If a function is called multiple times with the same input, you can
514
often speed things up by keeping a cache of known answers that it can
615
retrieve. This is called memoisation <http://en.wikipedia.org/wiki/Memoization>.
7-
The `memoise` package provides a simple syntax
16+
The `xmemoise` package is built upon [hadley/memoise](https://github.com/hadley/memoise), which provides a simple syntax
817

918
mf <- memoise(f)
1019

@@ -18,4 +27,27 @@ cache with
1827
is.memoised(mf) # TRUE
1928
is.memoised(f) # FALSE
2029

21-
.
30+
31+
`xmemoise` extends upon `memoise` by adding in additional types of caches. Items can be cached using the original cache implemented in `memoise` in addition to other options:
32+
33+
* [x] Google Datastore; Switch to using googleAuthR
34+
* [ ] Dropbox
35+
* [ ] Google Storage
36+
* [ ] AWS
37+
38+
39+
# Memoization with google datastore
40+
41+
Google Datastore
42+
43+
There are a few trade-offs to using google datastore for memoization.
44+
45+
```
46+
key <- "<google cloud oauth key>"
47+
secret <- "<google cloud oauth secret>"
48+
authenticate_datastore(key, secret, "<project-id>")
49+
50+
mem_fib <- memoise(fib, cache = datastore_cache("custom_cache_name"))
51+
mem_fib(20) # Saved to datastore; Can be retrieved on another computer.
52+
mem_fib(20) # Cached version retrieved from google datastore.
53+
```

0 commit comments

Comments
 (0)