Gin & Memcached memory

Hi, how can I run on Railway "memcached store" if there is already a service of my api running on one of the ports suggested by railway. I can't run memcache through it, code for context. Now I tried to use the port suggested but it is known that it will be rejected, because the memcache service will not run on such a port. What is the solution for this?
var mc *memcache.Client

func init() {
mc = memcache.New("localhost:11211")
}
var mc *memcache.Client

func init() {
mc = memcache.New("localhost:11211")
}
21 Replies
Percy
Percy2y ago
Project ID: 2d40044f-0bf7-475d-b975-0972037db8ba
gravgor
gravgor2y ago
2d40044f-0bf7-475d-b975-0972037db8ba
gravgor
gravgor2y ago
And yeah, now i get this response because of not running service of memcache
Brody
Brody2y ago
can you share your repo please?
gravgor
gravgor2y ago
yeap, but you need to give me your email or username for gh
Brody
Brody2y ago
brody192
gravgor
gravgor2y ago
send invite branch 7-auth-page viper-backend folder
Brody
Brody2y ago
i dont see anything thats gonna start the memcached server?
gravgor
gravgor2y ago
in api.go - mc = memcache.New i've just changed to use port dedicated for gin for the test and yeah outcome is error
Brody
Brody2y ago
thats a client? no?
gravgor
gravgor2y ago
yeah mc *memcache.Client and memcache.New starting client
Brody
Brody2y ago
but dont you need to run a memcached server?
gravgor
gravgor2y ago
memcache.New is creating a server and running in one
Brody
Brody2y ago
https://github.com/bradfitz/gomemcache
This is a memcache client library
.New returns a client from given servers
Brody
Brody2y ago
gravgor
gravgor2y ago
I think i found the problem, but i need to test it.
Brody
Brody2y ago
the problem is that youre thinking a client library is creating a server this library connects to a server, it doesn’t run a server
gravgor
gravgor2y ago
actually, my mistake - it's already too late for me I guess, thanks for suggesting it, because I would have been thinking all the time
Brody
Brody2y ago
why not just use an in memory cache library for go? or redis
gravgor
gravgor2y ago
i will use it now
Brody
Brody2y ago
forget my previous recommendations, you are saving users in the cache, instead you want to be using postgre or mysql for this
Want results from more Discord servers?
Add your server