Skip to content

Commit

Permalink
Add lru_cache for UsersPlugin's find method (#567)
Browse files Browse the repository at this point in the history
(DIS-2754)
  • Loading branch information
Poeloe authored Mar 7, 2024
1 parent 12aca2e commit 7e0275f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dissect/target/plugins/general/users.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from functools import lru_cache
from typing import Generator, NamedTuple, Optional, Union

from dissect.target import Target
from dissect.target.exceptions import UnsupportedPluginError
from dissect.target.helpers.fsutil import TargetPath
from dissect.target.helpers.record import UnixUserRecord, WindowsUserRecord
Expand All @@ -16,6 +18,10 @@ class UsersPlugin(InternalPlugin):

__namespace__ = "user_details"

def __init__(self, target: Target):
super().__init__(target)
self.find = lru_cache(32)(self.find)

def check_compatible(self) -> None:
if not hasattr(self.target, "users"):
raise UnsupportedPluginError("Unsupported Plugin")
Expand Down

0 comments on commit 7e0275f

Please sign in to comment.