Update sqlite3-python/README.md
This commit is contained in:
@@ -24,7 +24,7 @@ print(list(sql)) # [4]
|
|||||||
|
|
||||||
# Cache
|
# Cache
|
||||||
```python
|
```python
|
||||||
class SQL:
|
class Cache:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
import sqlite3
|
import sqlite3
|
||||||
con = sqlite3.connect('fetch.db', isolation_level=None, timeout=1e999)
|
con = sqlite3.connect('fetch.db', isolation_level=None, timeout=1e999)
|
||||||
@@ -44,9 +44,9 @@ class SQL:
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
if not (blob := self[url]): self[url] = urllib.request.urlopen(url).read()
|
if not (blob := self[url]): self[url] = urllib.request.urlopen(url).read()
|
||||||
return self[url]
|
return self[url]
|
||||||
sql = SQL()
|
cache = Cache()
|
||||||
sql.fetch('https://example.com')
|
cache.fetch('https://example.com')
|
||||||
list(sql)
|
print(list(cache))
|
||||||
```
|
```
|
||||||
|
|
||||||
# Class
|
# Class
|
||||||
|
|||||||
Reference in New Issue
Block a user