LoginSignup
0
0

More than 5 years have passed since last update.

Golangでローカル環境(WINDOWS)にて開発中にmemcachedを使用するには

Posted at

Golangでローカル環境(WINDOWS)にて開発中にmemcachedを使用するには

ローカル環境に開発している場合、下記とする
http://localhost:8080/v1/hogehoge
8080を使用している

ここに、下記のパッケージを取込む
https://github.com/bradfitz/gomemcache
ドキュメントに記載されているように、インストールを行い
Exampleを作成する。
ドキュメントのExampleを少し書き替える。

import (
        "github.com/bradfitz/gomemcache/memcache"
)

func main() {
     mc := memcache.New("localhost:11211")
     mc.Set(&memcache.Item{Key: "foo", Value: []byte("my value")})

     it, err := mc.Get("foo")
     ...
}

すると
下記のエラーが表示される

memcache: connect timeout to "localhost:11211"

まあ、当然である。
そこで、下記のmemocachedをインストールする。
但し、インストールする際、CMDを立ち上げてインストールを行うのだが
必ず管理者権限でCMDを立ち上げて操作すること。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0