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
package com.booking.service; | |
import org.springframework.cache.annotation.Cacheable; | |
import org.springframework.stereotype.Service; | |
@Service | |
public class BookingService { | |
@Cacheable("echoCacheWithParam") | |
public String getServiceDetails(String level) { |
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
package com.booking.contraller; | |
import com.booking.model.Booking; | |
import com.booking.service.BookingService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.*; | |
@RestController | |
@RequestMapping("booking") | |
public class BookingController { |
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
package com.booking; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.cache.annotation.EnableCaching; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.web.client.RestTemplate; | |
@SpringBootApplication | |
@EnableCaching |
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
package com.booking; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.data.redis.connection.RedisStandaloneConfiguration; | |
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; | |
import org.springframework.data.redis.core.RedisTemplate; | |
@Configuration |
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
spring.redis.host=xxx.xxx.xxx.xxx | |
spring.redis.port=xx | |
spring.redis.password=xxxxxxxx | |
spring.cache.redis.time-to-live=10000 |
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
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-data-redis</artifactId> | |
<version>2.7.0</version> | |
</dependency> | |
<dependency> | |
<groupId>io.pivotal.cfenv</groupId> | |
<artifactId>java-cfenv-boot</artifactId> | |
<version>2.4.0</version> |
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
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: redis-service | |
labels: | |
app: redis | |
spec: | |
selector: | |
app: redis | |
ports: |
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
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: redis | |
spec: | |
serviceName: redis | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: redis |
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
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: local-pv1 | |
spec: | |
storageClassName: local-storage | |
capacity: | |
storage: 1Gi | |
accessModes: | |
- ReadWriteOnce |
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
apiVersion: storage.k8s.io/v1 | |
kind: StorageClass | |
metadata: | |
name: local-storage | |
provisioner: kubernetes.io/no-provisioner | |
volumeBindingMode: WaitForFirstConsumer | |
allowVolumeExpansion: true | |
reclaimPolicy: Delete |
NewerOlder