All Projects β†’ xyproto β†’ simpleredis

xyproto / simpleredis

Licence: MIT license
πŸ“» Easy way to use Redis from Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to simpleredis

poeditor-cli
POEditor CLI
Stars: ✭ 29 (+16%)
Mutual labels:  strings
simplehstore
πŸͺ Easy way to use a PostgreSQL database (and the HSTORE feature) from Go
Stars: ✭ 54 (+116%)
Mutual labels:  strings
string theory
Flexible modern C++ string library with type-safe formatting
Stars: ✭ 32 (+28%)
Mutual labels:  strings
regXwild
⏱ Superfast ^Advanced wildcards++? | Unique algorithms that was implemented on native unmanaged C++ but easily accessible in .NET via Conari (with caching of 0x29 opcodes +optimizations) etc.
Stars: ✭ 20 (-20%)
Mutual labels:  strings
strings-case
Convert strings between different cases.
Stars: ✭ 65 (+160%)
Mutual labels:  strings
C-Complete-practice
This repository will contains C programs from beginners to advance level
Stars: ✭ 59 (+136%)
Mutual labels:  strings
solidity-standard-library
Solidity standard library (Array, random, math, string)
Stars: ✭ 61 (+144%)
Mutual labels:  strings
Data-Structures-Algorithms-Handbook
A series of important questions with solutions to crack the coding interview and ace it!
Stars: ✭ 30 (+20%)
Mutual labels:  strings
Libft
42 library of basic C functions - queues, lists, memory operations and more πŸ˜„
Stars: ✭ 21 (-16%)
Mutual labels:  strings
the-stringler
An OOP approach to string manipulation.
Stars: ✭ 36 (+44%)
Mutual labels:  strings
common
Metarhia Common Library
Stars: ✭ 55 (+120%)
Mutual labels:  strings
ostrich
An SMT Solver for string constraints
Stars: ✭ 18 (-28%)
Mutual labels:  strings
ResourcesPoet
Kotlin API for generating Android XML Resources
Stars: ✭ 102 (+308%)
Mutual labels:  strings
android-localization-helper
A python script that helps you create strings.xml for all languages in different hierarchical folder(using Google Translation API)
Stars: ✭ 19 (-24%)
Mutual labels:  strings
strsim
string similarity based on Dice's coefficient in go
Stars: ✭ 39 (+56%)
Mutual labels:  strings
strings-ansi
Handle ANSI escape codes in strings
Stars: ✭ 17 (-32%)
Mutual labels:  strings
concat
Demo repository for habr.com article about faster Go string concatenation.
Stars: ✭ 16 (-36%)
Mutual labels:  strings
wotpp
A small macro language for producing and manipulating strings.
Stars: ✭ 75 (+200%)
Mutual labels:  strings
gomoji
Helpful functions to work with emoji in Golang
Stars: ✭ 63 (+152%)
Mutual labels:  strings
stringsifter
A machine learning tool that ranks strings based on their relevance for malware analysis.
Stars: ✭ 567 (+2168%)
Mutual labels:  strings

Simple Redis

Build Status GoDoc Go Report Card

Easy way to use Redis from Go.

Packaging status

Online API Documentation

godoc.org

Features and limitations

  • Supports simple use of lists, hashmaps, sets and key/values
  • Deals mainly with strings
  • Uses the redigo package

Example usage

package main

import (
    "log"

    "github.com/xyproto/simpleredis"
)

func main() {
    // Check if the redis service is up
    if err := simpleredis.TestConnection(); err != nil {
        log.Fatalln("Could not connect to Redis. Is the service up and running?")
    }

    // Use instead for testing if a different host/port is up.
    // simpleredis.TestConnectionHost("localhost:6379")

    // Create a connection pool, connect to the given redis server
    pool := simpleredis.NewConnectionPool()

    // Use this for connecting to a different redis host/port
    // pool := simpleredis.NewConnectionPoolHost("localhost:6379")

    // For connecting to a different redis host/port, with a password
    // pool := simpleredis.NewConnectionPoolHost("password@redishost:6379")

    // Close the connection pool right after this function returns
    defer pool.Close()

    // Create a list named "greetings"
    list := simpleredis.NewList(pool, "greetings")

    // Add "hello" to the list, check if there are errors
    if list.Add("hello") != nil {
        log.Fatalln("Could not add an item to list!")
    }

    // Get the last item of the list
    if item, err := list.GetLast(); err != nil {
        log.Fatalln("Could not fetch the last item from the list!")
    } else {
        log.Println("The value of the stored item is:", item)
    }

    // Remove the list
    if list.Remove() != nil {
        log.Fatalln("Could not remove the list!")
    }
}

Testing

Redis must be up and running locally for the go test tests to work.

Timeout issues

If there are timeout issues when connecting to Redis, try consulting the Redis latency doctor on the server by running redis-cli and then latency doctor.

Version, license and author

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].