-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- implemented first version of init func (alg test missing)
- Loading branch information
1 parent
d94ab2a
commit 1f181ab
Showing
5 changed files
with
124 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
{ | ||
"files.associations": { | ||
"*.tcc": "cpp" | ||
} | ||
}, | ||
"python.linting.pylintEnabled": false, | ||
"python.linting.banditEnabled": true, | ||
"python.linting.enabled": true, | ||
"python.formatting.provider": "black" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import redis | ||
import hashlib | ||
|
||
|
||
class RedisController(object): | ||
|
||
__instance = None | ||
client: redis.Redis = None | ||
|
||
def __new__(cls): | ||
if RedisController.__instance is None: | ||
RedisController.__instance = object.__new__(cls) | ||
RedisController.__instance.client = redis.Redis('localhost', decode_responses=True) | ||
return RedisController.__instance | ||
|
||
def get(self, key): | ||
el = RedisController.__instance.client.get(key) | ||
return el if el is not None else "" | ||
|
||
def set(self, key, data): | ||
return RedisController.__instance.client.set(key, data) | ||
|
||
def hget(self, key): | ||
el = RedisController.__instance.client.hget(key) | ||
return el if el is not None else "" | ||
|
||
def hset(self, key, data: dict): | ||
return RedisController.__instance.client.hset(key, data) | ||
|
||
def lpush(self, key, data): | ||
return RedisController.__instance.client.lpush(key, data) | ||
|
||
def lrange(self, key, start=0, end=-1): | ||
return RedisController.__instance.client.lrange(key, start, end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters