john-kurkowski / john-kurkowski/tldextract

question on cache

Open
#357 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2k
Forks
219
PR merge metrics
No merged PRs in 30d

Description

One integration I have with tldextract is in a webapp.

I realized I should prime internal cache before the server forks, so do the following (all operations use the `_tldextractor`) before a fork:

```!python
import tldextract
_tldextractor = tldextract.TLDExtract()
_tldextractor("https://github.com/john-kurkowski/tldextract")
```

That successfully loads the json cache file into memory.

I have a few questions based on a review of the code:

Question 1 - that should remain until I invoke `update` - correct?

Question 2- the library doesn't seem to store any metadata about the cache or support a cache expiry. correct?

If my understanding of #2 is correct, I think it might be a good feature to support the following: allow TLDExtract to be invoked with a cache expiry (seconds) kwarg; if the PSL cache is stale, attempt a new download/parse/cache. This would only happen if the cache_expiry were sent to `__init__(` or `extract(`, so long running processes would not refresh unless explicitly told.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.