소스 정보
- 저장소
- Mte90/dotfiles
- 최근 소스 활동
- 2026년 8월 26일 09:10
- 감지된 SKILL.md 언어
- 영어
- 스타
- 51
- 포크
- 6
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/Mte90/dotfiles --skill redis명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | redis |
| description | Redis - in-memory database, caching, pub/sub, sessions, rate limiting, data structures |
| metadata | {"author":"mte90","version":"1.0.0","tags":["redis","database","caching","pub-sub","sessions","rate-limiting","data-structures","nosql"]} |
Redis - in-memory data structure store, used as database, cache, and message broker.
pip install django-redis
# settings.py
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'redis://127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
}
}
}
# settings.py
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'redis://127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'CONNECTION_POOL_KWARGS': {
'max_connections': 50,
'retry_on_timeout': True,
},
'SOCKET_CONNECT_TIMEOUT': 5,
'SOCKET_TIMEOUT': 5,
},
'KEY_PREFIX': 'myapp',
'VERSION': 1,
}
}
from django.core.cache import cache
# Set with expiration (seconds)
cache.set('key', 'value', timeout=300)
cache.set_many({'key1': 'value1', 'key2': 'value2'}, timeout=300)
# Get
value = cache.get('key')
value = cache.get('key', 'default_value')
# Delete
cache.delete('key')
cache.delete_pattern('user_*')
from django.views.decorators.cache import cache_page
@cache_page(60 * 15) # 15 minutes
def my_view(request):
return render(request, 'template.html')
{% load cache %}
{% cache 500 sidebar request.user.id %}
<div class="sidebar">
<!-- Content to cache -->
</div>
{% endcache %}
# settings.py
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
SESSION_CACHE_ALIAS = 'default'
Or with Redis directly:
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'redis://127.0.0.1:6379/0',
}
}
# settings.py
CELERY_BROKER_URL = 'redis://127.0.0.1:6379/0'
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379/1'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
# settings.py
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
'hosts': [('127.0.0.1', 6379)],
},
}
}
# settings.py with connection pool
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'redis://127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'CONNECTION_POOL_KWARGS': {
'max_connections': 100,
},
'PASSWORD': 'your_password',
}
}
}
# Connect
redis-cli
# Check keys
KEYS *
# Delete by pattern
FLUSHDB # Clear current database
# Reuse connection, don't create new each request
from django_redis import get_redis_connection
def get_redis():
# Global singleton
return get_redis_connection("default")
# Connection pool settings
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'redis://127.0.0.1:6379/1',
'OPTIONS': {
'CONNECTION_POOL_KWARGS': {
'max_connections': 100,
'retry_on_timeout': True,
},
'SOCKET_CONNECT_TIMEOUT': 5,
'SOCKET_TIMEOUT': 5,
}
}
}
# Use namespaced keys
KEY_PREFIX = 'myapp'
VERSION = 1
# Keys become: myapp:v1:user:123
# Add TTL to all keys
cache.set('temp_token', token, timeout=300) # 5 min
# Use consistent naming
cache.set('user:profile:123', data)
cache.set('user:session:123', data)
# Batch operations
cache.set_many({
'key1': 'value1',
'key2': 'value2',
'key3': 'value3',
}, timeout=3600)
# Use pipeline for multiple ops
pipe = cache.client.get_client()
pipe.set('a', 1)
pipe.set('b', 2)
pipe.execute() # Atomic, single round-trip
from django.core.cache import CacheKeyError
try:
value = cache.get('key')
except ConnectionError:
# Fallback to DB or default
value = get_from_db()