-
-
Notifications
You must be signed in to change notification settings - Fork 33
Caching data between runs
Almenon edited this page Mar 18, 2019
·
8 revisions
Sometimes you might execute a lengthy query that you do not want to run again. Never fear, you can cache the result so it is saved inbetween runs! You have two options:
-
use #$save (see readme)
-
Using "areplStore"
areplStore is a variable that will hold data between runs.
If you assign a value to it and then comment that line out you can still reference that variable.
from time import sleep
def longLastingFunction():
sleep(5)
x = longLastingFunction() # ugg takes forever each run
from time import sleep
def longLastingFunction():
sleep(5)
areplStore = longLastingFunction() # Instead I'll put it in my store
from time import sleep
def longLastingFunction():
sleep(5)
# areplStore = longLastingFunction() # comment this out now that store already has data
print(areplStore) # now I can get the function result without actually running the function!