Python Forum
Speeding up code using cache
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Speeding up code using cache
#1
I'm good with Python and use functions to process large datasets from files, then return the results. I've realized these input files and other parameters don't change often, so I could store the returned results for reuse.

I've used @functools.lru_cache before, but I'm facing a challenge now. Even though file paths (passed as input to my functions) remain the same, sometimes I need to ignore the cached values if the file has been updated since the last call. I don't want to complicate my functions by checking for this.

I'm looking for a caching solution that can handle this. If anyone knows an existing solution, I'd love to hear it, so I don't have to create one from scratch.
Reply


Messages In This Thread
Speeding up code using cache - by Peter - Jul-27-2023, 01:17 PM
RE: Speeding up code using cache - by bowlofred - Jul-29-2023, 04:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Opinion: how should my scripts cache web download files? stevendaprano 0 776 Dec-17-2022, 12:19 AM
Last Post: stevendaprano
  main libvlc error: stale plugins cache: schascheck 2 7,855 Dec-27-2020, 05:24 PM
Last Post: schascheck
  Clear Cache Path sportcardinal 0 1,661 Jul-05-2020, 05:11 PM
Last Post: sportcardinal
  How to print cache from Decorators with Memoization OlgaM 2 2,145 Jan-29-2020, 05:06 PM
Last Post: OlgaM
  pip cache millpond 3 8,325 Jul-22-2019, 01:12 AM
Last Post: millpond
  python cache for small integer Uchikago 1 2,558 Jun-27-2019, 05:32 PM
Last Post: ichabod801
  Error in request, cache key a21250450 2 3,204 Apr-02-2019, 11:20 AM
Last Post: a21250450
  Clear cache blackclover 0 2,841 May-09-2018, 12:13 AM
Last Post: blackclover
  Speeding up Brute force password guesser Gamervote 5 7,009 Jul-20-2017, 02:52 PM
Last Post: nilamo
  Create cache script AgatheYou 1 3,721 Apr-04-2017, 02:15 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020