May 4, 2024, 9:59 p.m. | Mustafa Karatas

DEV Community dev.to




Docker Compose File


Here is the basic docker-compose redis configuration



services:
redis:
image: redis:latest
restart: always
ports:
- "6379:6379"
environment:
- REDIS_PASSWORD=my-password
- REDIS_PORT=6379
- REDIS_DATABASES=16





Maven dependency



<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>





Application yml file



spring:
cache:
type: redis
redis:
host: localhost
port: 6379

cache:
config:
entryTtl: 60
jwtToken:
entryTtl: 30


In application yml file, cache type and redis host, port informations are defined.

Redis config class



@Configuration
@EnableCaching
@Slf4j
public class RedisConfig {

@Value("${spring.cache.redis.host}")
private String redisHost;

@Value("${spring.cache.redis.port}")
private …

application basic boot cache compose config configuration data dependency docker docker-compose environment file host image latest localhost maven org password port ports redis services spring spring-boot

Information Security Engineers

@ D. E. Shaw Research | New York City

Technology Security Analyst

@ Halton Region | Oakville, Ontario, Canada

Senior Cyber Security Analyst

@ Valley Water | San Jose, CA

COMM Penetration Tester (PenTest-2), Chantilly, VA OS&CI Job #368

@ Allen Integrated Solutions | Chantilly, Virginia, United States

Consultant Sécurité SI H/F Gouvernance - Risques - Conformité

@ Hifield | Sèvres, France

Infrastructure Consultant

@ Telefonica Tech | Belfast, United Kingdom