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

In-memory cache rather than on-disk #3

Open
gertvdijk opened this issue Feb 15, 2019 · 3 comments
Open

In-memory cache rather than on-disk #3

gertvdijk opened this issue Feb 15, 2019 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@gertvdijk
Copy link

Feature request. It would be great if it was possible to not write the cache to disk. I'm was trying to use this module to cache my expensive passwordstore lookups (ansible/ansible#52290), but I'd rather not write my passwords in plaintext to disk if this is not necessary.

@rouge8
Copy link
Contributor

rouge8 commented Feb 15, 2019

My original attempt was in-memory (just a dict at the top of the module), but I couldn't get that to actually work... 😕

@gertvdijk
Copy link
Author

My original attempt was in-memory (just a dict at the top of the module), but I couldn't get that to actually work... confused

Exactly what I tried and how I failed, when building my own plugin before discovering yours! 😄 It seems Ansible starts a whole new global context or something...

Anyway, if anyone would find a way, I'd be happy to hear about it.

@rouge8 rouge8 added the help wanted Extra attention is needed label Feb 15, 2019
@hdluc
Copy link

hdluc commented Oct 18, 2022

You could also make sqlite run in-memory only instead of using the disk by replacing the following:

    with Cache(os.path.join(C.DEFAULT_LOCAL_TMP, "cached_lookup")) as cache:

with

    with Cache(":memory:") as cache:        

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants