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

Make cachier() more abstract for using other cores #38

Closed

Conversation

cthoyt
Copy link
Contributor

@cthoyt cthoyt commented Oct 21, 2020

This PR adds the backend argument to the cachier() to allow users to explicitly set the core that is used. Right now, it does not include any new cores, but does give an example as to where potential codes supporting #4 and #6 could be added.

Sidebar: it might be the case that later, it needs to be reinvestigated how arguments are passed to the core - if there are many cores, having all of their extra arguments inside the cachier() function could get verbose. One way might be to use **kwargs, but I think it's worth waiting until other cores are implemented to worry about that abstractions.

If you're happy with this PR, I would also like to take a stab at implementing #6.

Now, the default is calculated dynamically to maintain previous behavior to default to pickle unless the ``mongetter`` argument is given. This makes it have the same behavior as before, so users aren't forced to change old code to use the ``backend`` argument
@codecov
Copy link

codecov bot commented Oct 21, 2020

Codecov Report

Merging #38 into master will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #38      +/-   ##
==========================================
+ Coverage   95.74%   95.85%   +0.11%     
==========================================
  Files           4        4              
  Lines         329      338       +9     
  Branches       31       34       +3     
==========================================
+ Hits          315      324       +9     
  Misses          8        8              
  Partials        6        6              
Impacted Files Coverage Δ
cachier/core.py 94.95% <100.00%> (+0.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e1999d...ae487b7. Read the comment docs.

@cthoyt
Copy link
Contributor Author

cthoyt commented Oct 22, 2020

@shaypal5 Thanks for the comment on the other thread. I just wanted to reiterate that this change doesn't break backwards compatibility and should be enough to enable at least the implementation of an in memory cache, which like the pickle one, can be instantiated without any extra kwargs. Thanks again for the consideration.

@cthoyt
Copy link
Contributor Author

cthoyt commented Nov 25, 2020

This code was merged via #39

@cthoyt cthoyt closed this Nov 25, 2020
@cthoyt cthoyt deleted the prepare-backend-extensible branch November 25, 2020 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant