context("MemoryCache")
test_that("Memory cache works correctly", {
mc <- MemoryCache$new()
mc$set(1, mtcars)
expect_equal(mc$get(1), mtcars)
expect_equal(nrow(mc$print_meta()), 1)
mc$delete(1)
expect_null(mc$get(1))
expect_equal(mc$get(1, default = 2), 2)
mc$trim()
mc$destroy()
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.