https://github.com/tuannh982/ladder
A fast, simple persistent queue written in Java
https://github.com/tuannh982/ladder
from-scratch java persistent-data-structure persistent-queue queue
Last synced: 3 months ago
JSON representation
A fast, simple persistent queue written in Java
- Host: GitHub
- URL: https://github.com/tuannh982/ladder
- Owner: tuannh982
- License: mit
- Created: 2021-07-25T13:19:44.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-12T03:05:07.000Z (about 4 years ago)
- Last Synced: 2025-04-11T06:34:17.102Z (6 months ago)
- Topics: from-scratch, java, persistent-data-structure, persistent-queue, queue
- Language: Java
- Homepage:
- Size: 31.3 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Ladder
======[](https://github.com/tuannh982/ladder/blob/master/LICENSE)
[](https://lgtm.com/projects/g/tuannh982/ladder/alerts)
[](https://lgtm.com/projects/g/tuannh982/ladder/context:java)## Introduction
Ladder is a lightning fast persistent queue written in Java.## Usage
### Installation
// TODO publish to Maven Central
### Create persistent queue instance
```java
String path = "/path/to/your/queue/dir";
Queue queue = new LadderQueue(
new File(path),
LadderQueueOptions.builder()
.dataFlushThreshold(512 * 1024)
.maxFileSize(100 * 1024)
.build()
);
```
### Basic operations
#### put
```java
byte[] data = new byte[] {...};
queue.put(data);
```
#### take
```java
byte[] read = queue.take();
```
#### poll
```java
long timeoutInMs = 500;
byte[] read = queue.poll(timeoutInMs);
```