Geocache is an in-memory cache that is suitable for geolocation based applications.

geocache GoDoc Go Report Card Build Status

geocache is an in-memory cache that is suitable for geolocation based applications. It uses geolocation as a key for storing items. You can specify range on initialization and thats it! You can store any object, it uses interface.

Installation

go get github.com/melihmucuk/geocache

Usage

geolocation cache

import (
	"fmt"
	"time"

	"github.com/melihmucuk/geocache"
)

func main() {
	c, err := geocache.NewCache(5*time.Minute, 30*time.Second, geocache.WithIn1KM)
	geoPoint := geocache.GeoPoint{Latitude: 40.9887, Longitude: 28.7817}
	if err != nil {
		fmt.Println("Error: ", err.Error())
	} else {
		c.Set(geoPoint, "helloooo", 2*time.Minute)
		v1, ok1 := c.Get(geocache.GeoPoint{Latitude: 41.2, Longitude: 29.3})
		v2, ok2 := c.Get(geocache.GeoPoint{Latitude: 41.2142, Longitude: 29.4234})
		v3, ok3 := c.Get(geocache.GeoPoint{Latitude: 40.9858, Longitude: 28.7852})
		v4, ok4 := c.Get(geocache.GeoPoint{Latitude: 40.9827, Longitude: 28.7883})
		fmt.Println(v1, ok1)
		fmt.Println(v2, ok2)
		fmt.Println(v3, ok3)
		fmt.Println(v4, ok4)
	}
}

outputs:

<nil>, false
<nil>, false
helloooo, true
helloooo, true

Information

You can specify 8 different range. More info can be found here.

  • WithIn11KM

The first decimal place is worth up to 11.1 km eg: 41.3, 29.6

  • WithIn1KM

The second decimal place is worth up to 1.1 km eg: 41.36, 29.63

  • WithIn110M

The third decimal place is worth up to 110 m eg: 41.367, 29.631

  • WithIn11M

The fourth decimal place is worth up to 11 m eg: 41.3674, 29.6316

  • WithIn1M

The fifth decimal place is worth up to 1.1 m eg: 41.36742, 29.63168

  • WithIn11CM

The sixth decimal place is worth up to 0.11 m eg: 41.367421, 29.631689

  • WithIn11MM

The seventh decimal place is worth up to 11 mm eg: 41.3674211, 29.6316893

  • WithIn1MM

The eighth decimal place is worth up to 1.1 mm eg: 41.36742115, 29.63168932

Owner
Melih Mucuk
Software Engineer, Golang, React-Native, .Net
Melih Mucuk
Similar Resources

Package cache is a middleware that provides the cache management for Flamego.

cache Package cache is a middleware that provides the cache management for Flamego. Installation The minimum requirement of Go is 1.16. go get github.

Nov 9, 2022

A mem cache base on other populator cache, add following feacture

memcache a mem cache base on other populator cache, add following feacture add lazy load(using expired data, and load it asynchronous) add singlefligh

Oct 28, 2021

A server for TurboRepo Remote Cache to store cache artefacts in Google Cloud Storage or Amazon S3

Tapico Turborepo Remote Cache This is an implementation of Vercel's Turborepo Remote Cache API endpoints used by the turborepo CLI command. This solut

Dec 13, 2022

Cache - A simple cache implementation

Cache A simple cache implementation LRU Cache An in memory cache implementation

Jan 25, 2022

Gin-cache - Gin cache middleware with golang

Gin-cache - Gin cache middleware with golang

Nov 28, 2022

Fast in-memory key:value store/cache with TTL

MCache library go-mcache - this is a fast key:value storage. Its major advantage is that, being essentially a thread-safe . map[string]interface{} wit

Nov 11, 2022

Eventually consistent distributed in-memory cache Go library

bcache A Go Library to create distributed in-memory cache inside your app. Features LRU cache with configurable maximum keys Eventual Consistency sync

Dec 2, 2022

Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service.

Olric Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service. With

Jan 4, 2023

An in-memory cache library for golang. It supports multiple eviction policies: LRU, LFU, ARC

GCache Cache library for golang. It supports expirable Cache, LFU, LRU and ARC. Features Supports expirable Cache, LFU, LRU and ARC. Goroutine safe. S

May 31, 2021

Distributed cache and in-memory key/value data store.

Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service.

Dec 30, 2022

Cachy is a simple and lightweight in-memory cache api.

Cachy is a simple and lightweight in-memory cache api.

cachy Table of Contents cachy Table of Contents Description Features Structure Configurability settings.json default values for backup_file_path Run o

Apr 24, 2022

A REST-API service that works as an in memory key-value store with go-minimal-cache library.

A REST-API service that works as an in memory key-value store with go-minimal-cache library.

Aug 25, 2022

In Memory cache in GO Lang Api

In memory key-value store olarak çalışan bir REST-API servisi Standart Kütüphaneler kullanılmıştır Özellikler key ’i set etmek için bir endpoint key ’

Dec 16, 2021

An in-memory key:value store/cache library written in Go 1.18 generics

go-generics-cache go-generics-cache is an in-memory key:value store/cache that is suitable for applications running on a single machine. This in-memor

Dec 27, 2022

CDN-like in-memory cache with shielding, and Go 1.18 Generics

cache CDN-like, middleware memory cache for Go applications with integrated shielding and Go 1.18 Generics. Usage package main import ( "context" "

Apr 26, 2022

Gocodecache - An in-memory cache library for code value master in Golang

gocodecache An in-memory cache library for code master in Golang. Installation g

Jun 23, 2022

Ristretto - A high performance memory-bound Go cache

Ristretto Ristretto is a fast, concurrent cache library built with a focus on pe

Dec 5, 2022

A zero-dependency cache library for storing data in memory with generics.

Memory Cache A zero-dependency cache library for storing data in memory with generics. Requirements Golang 1.18+ Installation go get -u github.com/rod

May 26, 2022

gpu-memory-monitor is a metrics server for collecting GPU memory usage of kubernetes pods.

gpu-memory-monitor is a metrics server for collecting GPU memory usage of kubernetes pods. If you have a GPU machine, and some pods are using the GPU device, you can run the container by docker or kubernetes when your GPU device belongs to nvidia. The gpu-memory-monitor will collect the GPU memory usage of pods, you can get those metrics by API of gpu-memory-monitor

Jul 27, 2022
Geocache is an in-memory cache that is suitable for geolocation based applications.
Geocache is an in-memory cache that is suitable for geolocation based applications.

geocache geocache is an in-memory cache that is suitable for geolocation based applications. It uses geolocation as a key for storing items. You can s

Oct 27, 2022
An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.

go-cache go-cache is an in-memory key:value store/cache similar to memcached that is suitable for applications running on a single machine. Its major

Dec 29, 2022
An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.

go-cache go-cache is an in-memory key:value store/cache similar to memcached that is suitable for applications running on a single machine. Its major

Dec 29, 2022
An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.

go-cache go-cache is an in-memory key:value store/cache similar to memcached that is suitable for applications running on a single machine. Its major

Jan 3, 2023
Speed up the memory allocation and improve the GC performance, especially for dynamic-memory-heavy applications.
Speed up the memory allocation and improve the GC performance, especially for dynamic-memory-heavy applications.

Linear Allocator for Golang Goal Speed up the memory allocation and improve the GC performance, especially for dynamic-memory-heavy applications. Pote

Dec 20, 2022
IP geolocation web server

freegeoip NOTE: as of April 2018 this repository is no longer active. Please visit https://github.com/apilayer/freegeoip/ for the current version. Thi

Dec 26, 2022
Just another "what is my IP address" service, including geolocation and headers information

What is my IP address What is my IP address Features Endpoints Build Usage Examples Run a default TCP server Run a TLS (HTTP/2) server only Run a defa

Nov 21, 2022
A little tool to test IP addresses quickly against a geolocation and a reputation API

iptester A little tool to test IP addresses quickly against a geolocation and a

May 19, 2022
Cache library for golang. It supports expirable Cache, LFU, LRU and ARC.
Cache library for golang. It supports expirable Cache, LFU, LRU and ARC.

GCache Cache library for golang. It supports expirable Cache, LFU, LRU and ARC. Features Supports expirable Cache, LFU, LRU and ARC. Goroutine safe. S

Dec 30, 2022
Dec 28, 2022