Skip to content
An efficient, file-based FIFO Queue for iOS and macOS.
Objective-C Ruby C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CASSampleApp Add information on how to use Cassette Aug 27, 2019
Cassette.xcodeproj Add sample app to test object queue api and features Aug 25, 2019
Cassette.xcworkspace Add workspace and pod files Aug 23, 2019
Cassette
CassetteTests
Pods Add workspace and pod files Aug 23, 2019
xcconfigs
.gitignore
CONTRIBUTING.md
Cassette.podspec Release 1.0.0-beta2 Nov 20, 2019
LICENSE Add new licensing and notices as part of ownership transfer to LinkedIn Aug 21, 2019
NOTICE Add new licensing and notices as part of ownership transfer to LinkedIn Aug 21, 2019
Podfile Add workspace and pod files Aug 23, 2019
Podfile.lock
README.md
azure-pipelines.yml introduce ADO plugin YAML config; remove travis Aug 23, 2019

README.md

Build Status

Cassette

Cassette is a collection of queue-related classes for iOS and macOS. It is maintained by LinkedIn. Cassette was originally implemented by Segment. Cassette was inspired by Tape.

QueueFile is an efficient, file-based FIFO queue. Addition and removal from an instance is an O(1) operation. Writes are synchronous; data will be written to disk before an operation returns. The queue is intended to be reliable and survive system or process crashes.

Installing the Library

CocoaPods

target 'MyApp' do
  pod 'Cassette', '1.0.0-beta2'
end

Manual

Download the latest binary of the library.

Usage

CASObjectQueue works with arbitrary objects that abide by the NSCoding protocol. An CASObjectQueue may be backed by a persistent CASQueueFile, or in memory.

CASObjectQueue<NSNumber *> *queue;

// Persistent ObjectQueue
NSError *error;
queue = [[CASFileObjectQueue alloc] initWithRelativePath:@"Test-File" error:&error];

// In-Memory ObjectQueue
queue = [[CASInMemoryObjectQueue alloc] init];

Add some data to the end of the queue.

[queue add:@1];

Read data at the head of the queue.

// Peek the eldest element.
NSNumber *data = [queue peek];

// Peek the eldest `n` elements.
NSArray<NSNumber *> *data = [queue peek:n];

Remove processed elements.

// Remove the eldest element.
[queue pop];

// Remove 'n' elements.
[queue pop:n];

// Remove all elements.
[queue clear];
You can’t perform that action at this time.