https://github.com/fsamin/go-hastack
Share a thread-safe FIFO Stack across multiple hosts
https://github.com/fsamin/go-hastack
Last synced: 2 months ago
JSON representation
Share a thread-safe FIFO Stack across multiple hosts
- Host: GitHub
- URL: https://github.com/fsamin/go-hastack
- Owner: fsamin
- License: apache-2.0
- Created: 2016-05-30T21:57:37.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-31T16:04:17.000Z (over 7 years ago)
- Last Synced: 2025-01-30T00:49:35.883Z (4 months ago)
- Language: Go
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Golang HA Stack
[](https://travis-ci.org/fsamin/go-hastack)
[](https://godoc.org/github.com/fsamin/go-hastack)
[](https://goreportcard.com/report/github.com/fsamin/go-hastack)Share a thread-safe FIFO Stack across multiple hosts. HA Stack use Redis as backend and helps you to push and pop elements in your stack.
## Open or connect to a Stack
Each stack have a logical name, a is accessible through redis.
```
stack, err := hastack.Connect("mystack", "localhost:6379", "", 3, 100)
```## Push
```
stack, _ := hastack.Connect("mystack", "localhost:6379", "", 3, 100)var data myData{
...,
}s.Push(data)
```## Pop
```
stack, _ := hastack.Connect("mystack", "localhost:6379", "", 3, 100)
var data myData{}
err := s.Pop(&data) //can be nil is there is no data in the stack
```## Blocking Pop
```
stack, _ = hastack.Connect("mystack", "localhost:6379", "", 3, 100)var data myData{}
err := s.BPop(&data) //This will block the thread until data can be poped
```