forked from platformio/platformio-core
Refactor @memoized decorator with expiration feature; cache installed boards per platform
This commit is contained in:
1 parent
0f4ab5b50b
commit
d54327f1a9
7 files changed
+25
-45
No files matched your search
@@ -23,7 +23,7 @@ from platformio.managers.package import PackageManager
|
||||
CORE_PACKAGES = {
|
||||
"contrib-piohome": ">=0.9.1,<2",
|
||||
"contrib-pysite": ">=0.2.0,<2",
|
||||
"tool-pioplus": ">=1.1.2,<2",
|
||||
"tool-pioplus": ">=1.1.3,<2",
|
||||
"tool-unity": "~1.20403.0",
|
||||
"tool-scons": "~2.20501.4"
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ class LibraryManager(BasePkgManager):
|
||||
return pkg_dir
|
||||
|
||||
|
||||
@util.memoized
|
||||
@util.memoized()
|
||||
def get_builtin_libs(storage_names=None):
|
||||
items = []
|
||||
storage_names = storage_names or []
|
||||
@@ -417,7 +417,7 @@ def get_builtin_libs(storage_names=None):
|
||||
return items
|
||||
|
||||
|
||||
@util.memoized
|
||||
@util.memoized()
|
||||
def is_builtin_lib(name):
|
||||
for storage in get_builtin_libs():
|
||||
if any(l.get("name") == name for l in storage['items']):
|
||||
|
||||
@@ -30,7 +30,7 @@ from platformio.managers.package import BasePkgManager, PackageManager
|
||||
|
||||
class PlatformManager(BasePkgManager):
|
||||
|
||||
FILE_CACHE_VALID = None # disable platform caching
|
||||
FILE_CACHE_VALID = None # disable platform download caching
|
||||
|
||||
def __init__(self, package_dir=None, repositories=None):
|
||||
if not repositories:
|
||||
@@ -158,6 +158,7 @@ class PlatformManager(BasePkgManager):
|
||||
self.cache_reset()
|
||||
return True
|
||||
|
||||
@util.memoized(expire=5000)
|
||||
def get_installed_boards(self):
|
||||
boards = []
|
||||
for manifest in self.get_installed():
|
||||
@@ -169,7 +170,7 @@ class PlatformManager(BasePkgManager):
|
||||
return boards
|
||||
|
||||
@staticmethod
|
||||
@util.memoized
|
||||
@util.memoized()
|
||||
def get_registered_boards():
|
||||
return util.get_api_result("/boards", cache_valid="7d")
|
||||
|
||||
|
||||
Reference in new issue
Block a user