Skip to content

Instantly share code, notes, and snippets.

@karanpathak
Created May 22, 2020 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karanpathak/5b8b135dd346d1ca040537383e72b366 to your computer and use it in GitHub Desktop.
Save karanpathak/5b8b135dd346d1ca040537383e72b366 to your computer and use it in GitHub Desktop.
# Create a new cache directory
cache_dir2 = "<path-to-your-directory>/sample_cache_dir2"
memory2 = Memory(cache_dir2, mmap_mode='c')
# Pass function to Memory.cache
@memory2.cache(verbose=0)
def func_memmap(x):
print("Example of Computationally intensive function!")
print("The result is not cached for this particular input")
sleep(4.0)
return np.square(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment