Mercurial
annotate asyncio_threads/database/main.py @ 96:70401cf61e97
[Seobeo] Added logging.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Fri, 02 Jan 2026 19:16:17 -0800 |
| parents | 46daba6e3cf4 |
| children |
| rev | line source |
|---|---|
|
48
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
1 class Database: |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
2 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
3 def __init__(self): |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
4 self.db = {} |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
5 self.state = 'idle' |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
6 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
7 def set(self, key, value): |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
8 self.db[key] = value |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
9 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
10 def get(self, key): |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
11 return self.db[key] |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
12 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
13 def unset(self, key): |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
14 del self.db[key] |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
15 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
16 |