Skip to content

Commit

Permalink
Improved speed
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan committed Dec 13, 2023
1 parent 3ac701d commit 70022e1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions upsonic/remote/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,12 @@ def unlock_key(self, key):
return False


def _update_set(self, key):
self.set(key+"_upsonic_updated", sha256(str(time.time()).encode()).hexdigest(), update_operation=True)

def set(self, key, value, encryption_key="a", compress=None, cache_policy=0, locking_operation=False, update_operation=False, version_tag=None, no_version=False):
if not locking_operation:
if self.lock_control(key):
self.console.log(f"[bold red] '{key}' is locked")
return None

if not update_operation:
self._update_set(key)



compress = True if self.force_compress else compress
Expand Down Expand Up @@ -341,8 +336,7 @@ def set(self, key, value, encryption_key="a", compress=None, cache_policy=0, loc
copy_data = copy.copy(data)
copy_data["key"] = copy_data["key"] + f"_upsonic_version_{version_tag}"
self._send_request("POST", "/controller/set", copy_data)
if not update_operation:
self._update_set(copy_data["key"])

elif self.version and not no_version:
the_version_ = self.get_set_version_tag()

Expand Down

0 comments on commit 70022e1

Please sign in to comment.