github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/service/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/github.com/micro/go-micro/registry#Registry).
     4  
     5  If you're looking for caching in your microservices use the [selector](https://micro.dev/docs/fault-tolerance.html#caching-discovery).
     6  
     7  ## Interface
     8  
     9  ```go
    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  ```go
    22  import "github.com/micro/go-micro/registry/cache"
    23  
    24  # create a new cache
    25  c := cache.New(registry)
    26  
    27  # get a service from the cache
    28  services, _ := c.GetService("helloworld")
    29  ```