Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Sep 28, 2020
2 parents e12a4bc + 5d07121 commit 23d55cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ docs/build
.vscode
test/build
Manifest.toml
test/cache
test/sessions
17 changes: 13 additions & 4 deletions test/tests_cache.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "Caching" begin
@safetestset "No Caching" begin
using Genie, Genie.Cache

function f()
Expand All @@ -9,7 +9,7 @@

r0 = f()

r1 = withcache(:x) do
r1 = withcache(:x) do
f()
end

Expand All @@ -20,9 +20,18 @@
end

@test r1 != r2 # because cache_duration == 0 so no caching
end


Genie.config.cache_duration = 5 # cache for 5s
@safetestset "cache" begin
using Genie, Genie.Cache

function f()
rand(1:1_000)
end

Genie.config.cache_duration = 5

r1 = withcache(:x) do
f()
end
Expand Down Expand Up @@ -58,4 +67,4 @@
end

@test r1 == r2 == r5 != r6
end;
end

0 comments on commit 23d55cf

Please sign in to comment.