---
# System prepended metadata

title: 所謂的 Configuration
tags: [Code]

---

所謂的 Configuration
===

Configuration Source 只有 application.properties, env ?
---

```sequence
participant Configurations
participant Adapter
participant Data Provider
participant Data Source

Note over Data Source: In Memory
Data Source --> Configurations:
Note over Data Source: Files
Note over Data Source: Envioronment
Note over Data Source: Databases (MSSQL, PostgreSQL, MySQL, Redis, etc)
Note over Data Source: 3rd party services
Note over Data Source: Event Message, Streaming
Data Source --> Data Provider:
Note over Data Provider: IO Reader
Note over Data Provider: DAL, Repository
Note over Data Provider: APIs, WebHook, etc
Note over Data Provider: RabbitMQ, Redis, Kafka, etc
Data Provider --> Adapter:
Adapter --> Configurations:
```

### 資料你在哪兒


- memory
- file (ex: application.properties, json file, yaml file...)
- system envioronment
- database (ex: MSSQL, Redis, MemoryDB, jsonDB)
- external service
- etc

#### 太難了

- 存在於 Memory 一定是被 cache 的資料嗎 ?
  - 有沒有一種可能, 它只是程式碼 method 內用到, 暫時存在的變數
  - 有沒有是 service configuration 的可能
  - etc

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

有一種實作方式叫做 In Memory
---

> Memory 是 Cache, 大聲叫出來 Redis 是 Cache [name=銀行業的霸氣 Programer]

話應該是這麼說的: `Cache 有幾種實作方式, ex: 透過 Memory or Redis 來存放資料`

### ChatGPT 大導師是這麼說的

> Cache is a type of memory that is used to store frequently accessed data in a computer system. It is typically faster and more efficient than main memory (e.g., RAM), because it is closer to the processor and can be accessed more quickly.
>
> Redis is an in-memory data structure store that is often used as a cache. It is often used to improve the performance of web applications by storing data in memory that would otherwise be stored on a slower backing store, such as a database. Redis can be used as a cache in a variety of situations, including storing session data, storing the results of expensive database queries, or storing the results of computations that are expensive to perform. [name=ChatGPT 大導師]

Spring 生態系有種東西叫做 Spring Cloud Config Server
---

### Service Discovery

### Configuration Server

> property data source
