Skip to content

Commit 9f18a8f

Browse files
initial commit🎉
1 parent 3f9e022 commit 9f18a8f

File tree

12 files changed

+171
-827
lines changed

12 files changed

+171
-827
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 cafebazaar
3+
Copyright (c) 2020 cafebazaar
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 30 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,77 @@
1-
# Mnemosyne
1+
# Athena
22

3-
Mnemosyne is a multilayer cache which can be configured to use various configurations of [Redis](https://redis.io/) and/or [BigCahce](https://github.com/allegro/bigcache) (an in-memory caching package) with minimum configuration out of the box.
3+
Athena is a A/B test library which make running simoultinious tests easy.
44

55
## Getting Started
66

77
### Installing
88

99
```console
10-
go get -u github.com/cafebazaar/mnemosyne
10+
go get -u git.cafebazaar.ir/bazaar/common/athena
1111
```
1212

1313

14-
### Initializing a Manager and Selecting a Cache Instance
14+
### Initializing an instance
1515

1616
```go
17-
mnemosyneManager := mnemosyne.NewMnemosyne(config, nil, nil)
18-
cacheInstance := mnemosyneManager.select("result-cache")
17+
athenaInstance := athena.NewAthena(config, nil)
1918
```
2019

21-
### Working with a cacheInstance
20+
### Working with test groups
2221
```go
23-
cacheInstance.Set(context, key, value)
24-
var myCachedData myType
25-
err := cacheInstance.Get(context, key, &myCachedData)
26-
// cache miss is also an Error
22+
athenaInstance.GetTestVariants("123")
2723
```
2824

2925
## Configuration
3026

31-
Mnemosyne uses Viper as it's config engine. Template of each cache instance includes the list of the layers' names (in order of precedence) followed by configuration for each layer.
27+
Athena uses Viper as it's config engine. Template of each cache instance includes the list of the testGroups' names followed by variants and other configurations for each test group.
3228
here's an example:
3329
```yaml
34-
cache:
35-
my-result-cache: # arbitary name for the cache instance
36-
soft-ttl: 2h
37-
layers: # Arbitary names for each cache layer
38-
- result-memory
39-
- result-gaurdian
40-
result-memory:
41-
type: memory
42-
max-memory: 512
43-
ttl: 2h
44-
amnesia: 10
45-
compression: true
46-
result-gaurdian:
47-
type: gaurdian
48-
address: "localhost:6379"
49-
slaves:
50-
- "localhost:6380"
51-
- "localhost:6381"
52-
db: 2
53-
ttl: 24h
54-
amnesia: 0
55-
compression: true
56-
my-user-cache:
57-
soft-ttl: 2h
58-
layers:
59-
- user-memory
60-
- user-redis
61-
user-memory:
62-
type: memory
63-
max-memory: 512
64-
ttl: 2h
65-
amnesia: 0
66-
compression: true
67-
user-redis:
68-
type: redis
69-
address: "localhost:6379"
70-
db: 4
71-
ttl: 24h
72-
amnesia: 0
73-
compression: true
30+
test:
31+
- name: test1
32+
default-variant: o1
33+
variants:
34+
- name: var1
35+
percentage: 30
36+
- name: var2
37+
percentage: 40
38+
- name: test2
39+
default-variant: o2
40+
variants:
41+
- name: var1
42+
percentage: 50
43+
- name: var2
44+
percentage: 20
7445
```
7546
76-
`soft-ttl` is an instance-wide TTL which when expired will **NOT** remove the data from the instance, but warns that the data is old
77-
78-
Each cache layer can be of types `redis`, `gaurdian`, `memory` or `tiny`. `redis` is used for a single node Redis server, `gaurdian` is used for a master-slave Redis cluster configuration, `memory` uses the BigCache library to provide an efficient and fast in-memory cache, `tiny` uses the native sync.map data structure to store smaller cache values in memory (used for low-write caches).
79-
Note: all of the cache types are sync-safe, meaning they can be safely used from simultaneously running goroutines.
80-
81-
#### Common layer configs:
82-
83-
`amnesia` is a stochastic fall-through mechanism which allows for a higher layer to be updated from a lower layer by the way of an artificial cache-miss,
84-
a 0 amnesia means that the layers will never miss a data that they actually have, a 10 amnesia means when a key is present in the cache, 90% of the time it is returned but 10% of the time it is ignored and is treated as a cache-miss. a 100 amnesia effectively turns the layer off. (Default: 0)
85-
86-
`compression` is whther the data is compressed before being put into the cache memory. Currently only Zlib compression is supported. (Default: false)
87-
88-
`ttl` is the hard Time To Live for the data in this particular layer, after which the data is expired and is expected to be removed.
89-
90-
#### Type-spesific layer configs:
91-
92-
`db` [`redis` - `gaurdian`] is the Redis DB number to be used. (Default:0)
93-
`idle-timeout` [`redis` - `gaurdian`] is the timeout for idle connections to the Redis Server (see Redis documentation) (Default:0 - no timeout)
94-
`address` [`redis` - `gaurdian`] is the Redis Server's Address (the master's address in case of a cluster)
95-
`slaves` [`gaurdian`] is a **list** of Redis servers addresses pertaining to the slave nodes.
96-
`max-memory` [`memory`] is the maximum amount of system memory which can be used by this particular layer.
97-
98-
9947
## Documentation
10048
101-
Documents are available at [https://godoc.org/github.com/cafebazaar/mnemosyne](https://godoc.org/github.com/cafebazaar/mnemosyne)
102-
103-
## Built With
104-
105-
* [Redis Go clinet](https://github.com/go-redis/redis) - Redis Client for Golang
106-
* [BigCahce](https://github.com/allegro/bigcache) - An In-Memory cache library
49+
Documents are available at [https://godoc.org/git.cafebazaar.ir/bazaar/common/athena](https://godoc.org/git.cafebazaar.ir/bazaar/common/athena)
10750
10851
## Contributing
10952
110-
Please read [CONTRIBUTING.md](https://github.com/cafebazaar/mnemosyne/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
53+
Please read [CONTRIBUTING.md](https://github.com/cafebazaar/athena/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
11154
11255
## Versioning
11356
114-
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/cafebazaar/mnemosyne/tags).
57+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/cafebazaar/athena/tags).
11558
11659
## Roadmap
11760
- Improve documentation
118-
- Add tests
61+
- Add config checks
11962
12063
## Authors
12164
122-
* **Ramtin Rostami** - *Initial work* - [rrostami](https://github.com/rrostami)
12365
* **Pedram Teymoori** - *Initial work* - [pedramteymoori](https://github.com/pedramteymoori)
124-
* **Parsa abdollahi** - *Initial work* - []()
12566
126-
See also the list of [contributors](https://github.com/cafebazaar/Mnemosyne/graphs/contributors) who participated in this project.
67+
See also the list of [contributors](https://github.com/cafebazaar/athena/graphs/contributors) who participated in this project.
12768
12869
## License
12970
13071
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
13172
13273
## Acknowledgments
13374
134-
* [Sepehr nematollahi](https://www.behance.net/sseeppeehhrr) Mnemosyne typography designer
75+
* [Sepehr nematollahi](https://www.behance.net/sseeppeehhrr) Athena typography designer
13576
136-
Made with <span class="heart">❤</span> in Cafebazaar search
77+
Made with <span class="heart">❤</span> in Cafebazaar search/ Cafebazaar discovery teams

0 commit comments

Comments
 (0)