mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-14 20:16:04 +00:00
[Update] 修改permisstion util
This commit is contained in:
@@ -16,6 +16,7 @@ import calendar
|
||||
import threading
|
||||
from io import StringIO
|
||||
import uuid
|
||||
from functools import wraps
|
||||
|
||||
import paramiko
|
||||
import sshpubkeys
|
||||
@@ -395,3 +396,17 @@ class TeeObj:
|
||||
def close(self):
|
||||
self.file_obj.close()
|
||||
|
||||
|
||||
def with_cache(func):
|
||||
cache = {}
|
||||
key = "_{}.{}".format(func.__module__, func.__name__)
|
||||
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
cached = cache.get(key)
|
||||
if cached:
|
||||
return cached
|
||||
res = func(*args, **kwargs)
|
||||
cache[key] = res
|
||||
return res
|
||||
return wrapper
|
||||
|
||||
Reference in New Issue
Block a user