backend: cache backend

Description Usage Arguments Details Value See Also Examples

View source: R/backend.R

Description

An backend definitions

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
backend(name, reader, writer, ext, ...)

## S3 method for class 'backend'
print(x, ...)

backend_ext(backend = cache_backend())

as_backend(x, ...)

## S3 method for class 'character'
as_backend(x, ...)

## S3 method for class 'fs_ext'
as_backend(x, ...)

## S3 method for class 'fs_path'
as_backend(x, ...)

Arguments

name

string; name of backend.

reader

function for reading from the cache

writer

function for writing to the cache

ext

string extension associated with this file without the period.

...

other name-value pairs that are stored as part of the definitions

backend

string; name for backend

Details

A backend is the way cache reads and writes from the cache. This simply collects all the information associated with the backend in one list.

A backend for a cache contains complete details about storing and retrieving files

backend_ext() gives the extensions associated with a backend.

as_backend retrieves the backend based on x. x can be the name of the backend, the extension associated with the backend or a file (with a known extension). In every case, a backend object is returned.

Value

list with subclass backend

A ext() object for the backend

as_backends returns a backend object based on x:

See Also

Examples

1
2
3
4
5
  backend( name="rds", reader=function() NULL, writer=function() NULL, ext="rds" )

  'rds' %>% fs_ext() %>% as_backend() %>% .$name

  'cache/iris.rds' %>% fs_path() %>% as_backend() %>% .$name

decisionpatterns/cache documentation built on June 15, 2020, 9:35 p.m.