Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true

env:
REDIS_HOSTNAME: redis
VALKEY_HOSTNAME: valkey
jobs:
linux:
runs-on: ubuntu-latest
Expand All @@ -25,11 +25,11 @@ jobs:
container:
image: ${{ matrix.image }}
services:
redis:
image: redis
valkey:
image: valkey/valkey
ports:
- 6379:6379
options: --entrypoint redis-server
options: --entrypoint valkey-server

steps:
- name: Checkout
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Convert coverage files
run: |
llvm-cov export -format="lcov" \
.build/debug/hummingbird-redisPackageTests.xctest \
.build/debug/hummingbird-valkeyPackageTests.xctest \
-ignore-filename-regex="\/Tests\/" \
-ignore-filename-regex="\/Benchmarks\/" \
-instr-profile .build/debug/codecov/default.profdata > info.lcov
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:

env:
REDIS_HOSTNAME: redis
VALKEY_HOSTNAME: valkey
jobs:
linux:
runs-on: ubuntu-latest
Expand All @@ -15,11 +15,11 @@ jobs:
container:
image: swiftlang/swift:${{ matrix.image }}
services:
redis:
image: redis
valkey:
image: valkey/valkey
ports:
- 6379:6379
options: --entrypoint redis-server
options: --entrypoint valkey-server

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .spi.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version: 1
external_links:
documentation: "https://docs.hummingbird.codes/2.0/documentation/hummingbirdredis"
documentation: "https://docs.hummingbird.codes/2.0/documentation/hummingbirdvalkey"
18 changes: 9 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
// swift-tools-version:5.9
// swift-tools-version:6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "hummingbird-redis",
platforms: [.macOS(.v14), .iOS(.v17), .tvOS(.v17)],
name: "hummingbird-valkey",
platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18)],
products: [
.library(name: "HummingbirdRedis", targets: ["HummingbirdRedis"])
.library(name: "HummingbirdValkey", targets: ["HummingbirdValkey"])
],
dependencies: [
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.5.0"),
.package(url: "https://github.com/swift-server/RediStack.git", from: "1.4.0"),
.package(url: "https://github.com/valkey-io/valkey-swift.git", from: "0.1.0"),
],
targets: [
.target(
name: "HummingbirdRedis",
name: "HummingbirdValkey",
dependencies: [
.product(name: "Hummingbird", package: "hummingbird"),
.product(name: "RediStack", package: "RediStack"),
.product(name: "Valkey", package: "valkey-swift"),
]
),
.testTarget(
name: "HummingbirdRedisTests",
name: "HummingbirdValkeyTests",
dependencies: [
.byName(name: "HummingbirdRedis"),
.byName(name: "HummingbirdValkey"),
.product(name: "Hummingbird", package: "hummingbird"),
.product(name: "HummingbirdTesting", package: "hummingbird"),
]
Expand Down
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,51 @@
<a href="https://swift.org">
<img src="https://img.shields.io/badge/swift-5.9-brightgreen.svg"/>
</a>
<a href="https://github.com/hummingbird-project/hummingbird-redis/actions?query=workflow%3ACI">
<img src="https://github.com/hummingbird-project/hummingbird-redis/actions/workflows/ci.yml/badge.svg?branch=main"/>
<a href="https://github.com/hummingbird-project/hummingbird-valkey/actions?query=workflow%3ACI">
<img src="https://github.com/hummingbird-project/hummingbird-valkey/actions/workflows/ci.yml/badge.svg?branch=main"/>
</a>
<a href="https://discord.gg/7ME3nZ7mP2">
<img src="https://img.shields.io/badge/chat-discord-brightgreen.svg"/>
</a>
</p>

# Hummingbird Redis Interface
# Hummingbird Valkey/Redis Interface

Redis is an open source, in-memory data structure store, used as a database, cache, and message broker.
Valkey is an open source, in-memory data structure store, used as a database, cache, and message broker.

This is the Hummingbird interface to [RediStack library](https://gitlab.com/mordil/RediStack.git) a Swift driver for Redis.
This is the Hummingbird interface to the [valkey-swift library](https://github.com/valkey-io/valkey-swift.git) a Swift driver for Valkey/Redis. Currently HummingbirdValkey consists of driver for the Hummingbird persist framework.

## Usage

```swift
import Hummingbird
import HummingbirdRedis
import HummingbirdValkey

let redis = try RedisConnectionPoolService(
.init(hostname: redisHostname, port: 6379),
logger: Logger(label: "Redis")
)
let valkey = ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: Logger(label: "Valkey"))
let persist = ValkeyPersistDriver(client: valkeyClient)

// create router and add a single GET /redis route
// create router and add a GET /valkey/{key} and PUT /valkey/{key} routes
let router = Router()
router.get("redis") { request, _ -> String in
let info = try await redis.send(command: "INFO").get()
return String(describing: info)
router.get("valkey/{key}") { request, context -> String? in
let key = try context.parameters.require("key")
return try await persist.get(key: .init(key), as: String.self)
}
router.put("valkey/{key}") { request, context in
let key = try context.parameters.require("key")
let value = try request.uri.queryParameters.require("value")
try await persist.set(key: key, value: value)
return HTTPResponse.Status.ok
}
// create application using router
var app = Application(
router: router,
configuration: .init(address: .hostname("127.0.0.1", port: 8080))
)
app.addServices(redis)
app.addServices(valkey)
// run hummingbird application
try await app.runService()
```

## Documentation

Reference documentation for HummingbirdRedis can be found [here](https://docs.hummingbird.codes/2.0/documentation/hummingbirdredis)
Reference documentation for HummingbirdValkey can be found [here](https://docs.hummingbird.codes/2.0/documentation/hummingbirdvalkey)
26 changes: 0 additions & 26 deletions Sources/HummingbirdRedis/Deprecations.swift

This file was deleted.

71 changes: 0 additions & 71 deletions Sources/HummingbirdRedis/Persist+Redis.swift

This file was deleted.

66 changes: 0 additions & 66 deletions Sources/HummingbirdRedis/Redis+Codable.swift

This file was deleted.

Loading
Loading