1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

add customized redis caching handler

This commit is contained in:
checktheroads
2020-04-13 01:05:24 -07:00
parent 97484e16c2
commit eebe9b2f11
4 changed files with 140 additions and 13 deletions

View File

@@ -86,6 +86,17 @@ class Query(BaseModel):
"""Create SHA256 hash digest of model representation."""
return hashlib.sha256(repr(self).encode()).hexdigest()
@property
def summary(self):
"""Create abbreviated representation of instance."""
items = (
f"query_location={self.query_location}",
f"query_type={self.query_type}",
f"query_vrf={self.query_vrf.name}",
f"query_target={str(self.query_target)}",
)
return f'Query({", ".join(items)})'
@validator("query_type")
def validate_query_type(cls, value):
"""Ensure query_type is enabled.