Skip to content

Commit

Permalink
closed #98
Browse files Browse the repository at this point in the history
  • Loading branch information
patx committed Jan 6, 2025
1 parent 38d54ff commit 741cf05
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pickledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ def __init__(self, location, auto_dump=True, enable_ttl=False):
self._load()
self._set_signal_handler()

def __getitem__(self, item):
'''Syntax sugar for get()'''
return self.get(item)

def __setitem__(self, key, value):
'''Sytax sugar for set()'''
return self.set(key, value)

def __delitem__(self, key):
'''Sytax sugar for rem()'''
return self.rem(key)

def _set_signal_handler(self):
"""Set up signal handler for graceful shutdown."""
signal.signal(signal.SIGTERM, self._graceful_exit)
Expand Down

0 comments on commit 741cf05

Please sign in to comment.