From 456e8224640560b410bb15d35a054592f9420727 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Sun, 23 Aug 2026 09:00:00 +0200 Subject: [PATCH] chore: add gitignore and build configuration --- .formatter.exs | 4 ++++ .gitignore | 32 ++++++++++++++++++++++++++++++++ config/config.exs | 14 ++++++++++++++ config/test.exs | 5 +++++ mix.exs | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 .formatter.exs create mode 100644 .gitignore create mode 100644 config/config.exs create mode 100644 config/test.exs create mode 100644 mix.exs diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f208073 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# The directory Mix will write compiled artifacts to. +/_build/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Compiled BEAM bytecode and archive artifacts. +*.beam +*.ez + +# Package tarball built via "mix hex.build". +excache-*.tar + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# Where third-party dependencies like ExDoc output generated docs. +/doc/ + +# ElixirLS language server workspace. +.elixir_ls/ + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Runtime scratch space (AOF log and snapshot dumps written by tests). +/tmp/ + +# OS, log, and local environment files. +.DS_Store +*.log +.env diff --git a/config/config.exs b/config/config.exs new file mode 100644 index 0000000..478b97d --- /dev/null +++ b/config/config.exs @@ -0,0 +1,14 @@ +import Config + +config :excache, + shard_count: 8, + sweep_interval: 1000, + port: String.to_integer(System.get_env("EXCACHE_PORT") || "6379"), + snapshot_path: System.get_env("EXCACHE_SNAPSHOT_PATH"), + aof_path: System.get_env("EXCACHE_AOF_PATH"), + aof_fsync: :everysec, + keyspace_notifications: true + +if File.exists?(Path.join(__DIR__, "#{config_env()}.exs")) do + import_config "#{config_env()}.exs" +end diff --git a/config/test.exs b/config/test.exs new file mode 100644 index 0000000..d8d957a --- /dev/null +++ b/config/test.exs @@ -0,0 +1,5 @@ +import Config + +config :excache, + port: nil, + sweep_interval: 50 diff --git a/mix.exs b/mix.exs new file mode 100644 index 0000000..5e279ab --- /dev/null +++ b/mix.exs @@ -0,0 +1,33 @@ +defmodule Excache.MixProject do + use Mix.Project + + def project do + [ + app: :excache, + version: "0.1.0", + elixir: "~> 1.18", + elixirc_paths: elixirc_paths(Mix.env()), + start_permanent: Mix.env() == :prod, + deps: deps() + ] + end + + defp elixirc_paths(:test), do: ["lib", "test/support"] + defp elixirc_paths(_env), do: ["lib"] + + # Run "mix help compile.app" to learn about applications. + def application do + [ + extra_applications: [:logger], + mod: {Excache.Application, []} + ] + end + + # Run "mix help deps" to learn about dependencies. + defp deps do + [ + # {:dep_from_hexpm, "~> 0.3.0"}, + # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"} + ] + end +end