0

Here's the idea: I have a web application which will read data from files, manipulate it, and JSONify it for javascript to pretty up.

The data is fetched by a cron which will run a python script that makes the files by querying a database and writing it. However, this data will only be fetched at specific, configurable times.

My goal is to cache the data until the cron runs. Is there a way to cache until a specified time?

4

1 回答 1

0

1)您可以尝试使用将数据存储在指定缓存数据库中的python包,该包会将所有带有标头和cookie的响应存储到demo_cache.sqlite数据库中。写:

import requests
import requests_cache

requests_cache.install_cache('demo_cache')

这是包请求缓存的文档

2)您也可以为此目的检查烧杯。

于 2013-10-25T15:40:21.947 回答