-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from wednesday-solutions/feat/readme-updated-a…
…nd-other-validations Readme file updated along with other validations
- Loading branch information
Showing
11 changed files
with
160 additions
and
181 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,19 +1,19 @@ | ||
SECRET_KEY=your_secret_key | ||
# Database Configuration | ||
DB_NAME= | ||
DB_HOSTNAME=localhost | ||
DB_PORT=3306 | ||
DB_USERNAME= | ||
DB_PASSWORD= | ||
DB_HOSTNAME= | ||
DB_PORT= | ||
DB_NAME= | ||
SECRET_KEY= | ||
REDIS_URL= | ||
DB_ROOT_PASSWORD= | ||
# Additional Configuration | ||
REDIS_URL=redis://localhost:6379/ | ||
SENTRY_DSN= | ||
SLACK_WEBHOOK_URL= | ||
ENVIRONMENT_NAME= | ||
DB_ROOT_PASSWORD= //this is applicable for .env.local file only | ||
// you will get these data from signoz portal | ||
# Advance Usage - Signoz Configuration | ||
OTEL_RESOURCE_ATTRIBUTES= | ||
OTEL_EXPORTER_OTLP_ENDPOINT= | ||
OTEL_EXPORTER_OTLP_HEADERS= | ||
OTEL_EXPORTER_OTLP_PROTOCOL= | ||
CACHE_ENABLED= | ||
SENTRY_ENABLED= | ||
SLACK_ENABLED= | ||
# Docker Configuration | ||
ENVIRONMENT_NAME= |
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
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
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 |
---|---|---|
@@ -1,32 +1,24 @@ | ||
from __future__ import annotations | ||
|
||
from app.config.base import settings | ||
from app.config.redis_config import get_redis_pool | ||
|
||
|
||
class CacheUtils: | ||
CACHE_ENABLED = settings.CACHE_ENABLED | ||
|
||
@classmethod | ||
async def create_cache(cls, resp, key: str, ex: int = 60): | ||
if cls.CACHE_ENABLED: | ||
redis = await get_redis_pool() | ||
await redis.set(key, resp, ex=ex) | ||
redis = await get_redis_pool() | ||
await redis.set(key, resp, ex=ex) | ||
|
||
@classmethod | ||
async def retrieve_cache(cls, key: str): | ||
if cls.CACHE_ENABLED: | ||
redis = await get_redis_pool() | ||
data = await redis.get(key) | ||
if not data: | ||
return None, None | ||
expire = await redis.ttl(key) | ||
return data, expire | ||
return None, None | ||
redis = await get_redis_pool() | ||
data = await redis.get(key) | ||
if not data: | ||
return None, None | ||
expire = await redis.ttl(key) | ||
return data, expire | ||
|
||
@classmethod | ||
async def invalidate_cache(cls, key: str): | ||
if cls.CACHE_ENABLED: | ||
redis = await get_redis_pool() | ||
await redis.delete(key) | ||
return None | ||
redis = await get_redis_pool() | ||
await redis.delete(key) |
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
Oops, something went wrong.
f1453be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report