Um servidor de cache HTTP simples construído em Erlang usando Cowboy e Mnesia.
Este projeto implementa um servidor de cache que pode:
- Receber requisições GET para buscar dados do cache
- Gerenciar workers de cache através de um supervisor dedicado
cache_server_app
└── cache_server_sup (supervisor principal)
├── cache_server_http_listen (servidor HTTP Cowboy)
└── cache_handle_supervisor (supervisor de workers de cache)
- cache_server_app: Aplicação principal
- cache_server_sup: Supervisor principal que gerencia o servidor HTTP e o supervisor de cache
- cache_server_http_listen: Configura o Cowboy para receber requisições HTTP
- cache_handle_supervisor: Supervisor para gerenciar workers de cache
- get_handler: Handler HTTP que processa as requisições GET
- Erlang/OTP 24 ou superior
- GNU Make 4 ou superior
- Git
# Clone o repositório
git clone https://github.com/Erlang-Brasil/cache_server
cd cache_server
# Compilar o projeto
make
# Criar release
make rel# Executar em modo desenvolvimento
make run
# Ou executar o release
./_rel/cache_server_release/bin/cache_server_release consoleO servidor estará disponível em http://localhost:8080
curl http://localhost:8080/caminho/para/recursocurl -X POST http://localhost:8080/caminho/para/recurso \
-H "Content-Type: application/json" \
-d '{"data": "valor"}'src/
├── cache_server_app.erl # Aplicação principal
├── cache_server_sup.erl # Supervisor principal
├── cache_server_http_listen.erl # Configuração do Cowboy
├── cache_handle_supervisor.erl # Supervisor de workers de cache
└── get_handler.erl # Handler HTTP
config/
├── sys.config # Configuração do sistema
└── vm.args # Argumentos da VM Erlang
relx.config # Configuração do release
# Compilar
make
# Executar testes
make ct
# Limpar build
make clean
# Executar em modo desenvolvimento
make run
# Criar release
make rel
# Executar release
make runA porta padrão é 8080. Para alterar, edite src/cache_server_http_listen.erl:
Edite config/sys.config para configurações específicas da aplicação.
- Fork o projeto
- Crie uma branch para sua feature (
git checkout -b feature/nova-feature) - Commit suas mudanças (
git commit -am 'Adiciona nova feature') - Push para a branch (
git push origin feature/nova-feature) - Abra um Pull Request
Este projeto está sob a licença MIT. Veja o arquivo LICENSE para mais detalhes.