Skip to content

Commit

Permalink
Merge branch 'master' into mm/keep-original-function-methods
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj authored Jan 6, 2021
2 parents c0f1959 + 6647564 commit 1c90274
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ExpiringCaches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ macro cacheable(timeout, func)
return esc(quote
const $cacheName = ExpiringCaches.Cache{Tuple{$(argTypes...)}, $returnType}($timeout)
$internalFunction
function $funcName($(funcArgs...))::$returnType
Base.@__doc__ function $funcName($(funcArgs...))::$returnType
return get!($cacheName, tuple($(funcArgs...))) do
$internalFuncName($(funcArgs...))
end
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
using Test, Dates, ExpiringCaches

"""
foo(arg1::Int, arg2::String)
Some docs to check that it doesn't break.
"""
ExpiringCaches.@cacheable Dates.Second(3) function foo(arg1::Int, arg2::String)::Float64
sleep(2)
return arg1 / length(arg2)
Expand Down

0 comments on commit 1c90274

Please sign in to comment.