Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to clear cache #14

Closed
djsegal opened this issue Jun 11, 2017 · 5 comments
Closed

Way to clear cache #14

djsegal opened this issue Jun 11, 2017 · 5 comments

Comments

@djsegal
Copy link

djsegal commented Jun 11, 2017

For example,

  • let's say you need to do a few batches of jobs
  • the functions need to be cleared out after each batch

are you supposed to use a dictionary as the key store and clear it out each time?

@djsegal
Copy link
Author

djsegal commented Jun 11, 2017

my current way around it:

function dememoize()

  mod = current_module()

  all_caches = filter( x ->
    startswith(string(x), "##") &&
    endswith(string(x),"_memoized_cache"),
    names(mod, true)
  )

  for cur_cache_symbol in all_caches
    empty!(getfield(mod, cur_cache_symbol))
  end

end

@colinfang
Copy link

@djsegal FYI, I have an implementation of Memorize.jl that does clear cache.

@djsegal
Copy link
Author

djsegal commented Jun 30, 2017

That's pretty sweet.

Are you planning on renaming it and submitting it to METADATA.jl?

@PharmCat
Copy link

PharmCat commented Oct 5, 2019

Is a way to clear cache now?
I think Momoize leads to a memory leak without clear cache function.

@cstjean
Copy link
Collaborator

cstjean commented Dec 15, 2020

Fixed by #60

@cstjean cstjean closed this as completed Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants