mirror of
https://github.com/SynologyOpenSource/pkgscripts-ng.git
synced 2025-07-23 02:55:16 +00:00
14 lines
313 B
Python
14 lines
313 B
Python
#!/usr/bin/python3
|
|
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
|
|
|
class cache(dict):
|
|
def __init__(self, func):
|
|
self.func = func
|
|
|
|
def __call__(self, *args):
|
|
return self[args]
|
|
|
|
def __missing__(self, key):
|
|
result = self[key] = self.func(*key)
|
|
return result
|