gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/registry/cache/README.md (about)

     1  # Registry Cache 
     2  
     3  Cache is a library that provides a caching layer for the go-micro [registry](https://godoc.org/gitee.com/liuxuezhan/go-micro-v1.18.0/registry#Registry).
     4  
     5  If you're looking for caching in your microservices use the [selector](https://micro.mu/docs/fault-tolerance.html#caching-discovery).
     6  
     7  ## Interface
     8  
     9  ```
    10  // Cache is the registry cache interface
    11  type Cache interface {
    12  	// embed the registry interface
    13  	registry.Registry
    14  	// stop the cache watcher
    15  	Stop()
    16  }
    17  ```
    18  
    19  ## Usage
    20  
    21  ```
    22  import (
    23  	"gitee.com/liuxuezhan/go-micro-v1.18.0/registry"
    24  	"gitee.com/liuxuezhan/go-micro-v1.18.0/registry/cache"
    25  )
    26  
    27  r := registry.NewRegistry()
    28  cache := cache.New(r)
    29  
    30  services, _ := cache.GetService("my.service")
    31  ```