Skip to content

Commit

Permalink
Merge pull request #32 from configcat/fix-cache-key
Browse files Browse the repository at this point in the history
Fix cache key generation
  • Loading branch information
z4kn4fein authored Jun 13, 2022
2 parents 99786cb + 834ad56 commit 19b701a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configcatclient/configcatclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ def __get_settings(self):
return self._cache_policy.get()

def __get_cache_key(self):
return hashlib.sha1(('python_' + CONFIG_FILE_NAME + '_' + self._sdk_key).encode('utf-8'))
return hashlib.sha1(('python_' + CONFIG_FILE_NAME + '_' + self._sdk_key).encode('utf-8')).hexdigest()
2 changes: 1 addition & 1 deletion configcatclient/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CONFIGCATCLIENT_VERSION = "6.0.1"
CONFIGCATCLIENT_VERSION = "6.0.2"
8 changes: 8 additions & 0 deletions configcatclienttests/test_configcatclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ def test_get_all_values(self):
self.assertFalse(all_values['key2'])
client.stop()

def test_cache_key(self):
client1 = ConfigCatClient('test1', 0, 0, None, 0, config_cache_class=ConfigCacheMock)
client2 = ConfigCatClient('test2', 0, 0, None, 0, config_cache_class=ConfigCacheMock)
self.assertEqual("5a9acc8437104f46206f6f273c4a5e26dd14715c", client1._ConfigCatClient__get_cache_key())
self.assertEqual("ade7f71ba5d52ebd3d9aeef5f5488e6ffe6323b8", client2._ConfigCatClient__get_cache_key())
client1.stop()
client2.stop()


if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def parse_requirements(filename):
return [line for line in lines if line]


configcatclient_version = '6.0.1'
configcatclient_version = '6.0.2'

requirements = parse_requirements('requirements.txt')

Expand Down

0 comments on commit 19b701a

Please sign in to comment.