Skip to content

Commit

Permalink
Update some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Tkachenko committed Nov 19, 2022
1 parent 6e53c07 commit ff9826a
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package care

import "time"

// A 'Cache' represents a common interface for responses caching.
// Cache represents a common interface for responses caching.
// It can be implemented for many caches like Redis, Memcached, etc,
type Cache interface {
// Put data into the cache by key.
Expand Down
2 changes: 1 addition & 1 deletion clientunaryinterceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (s *unaryClientInterceptor) Unary() grpc.UnaryClientInterceptor {
}
}

// Makes a new unary client interceptor.
// NewClientUnaryInterceptor makes a new unary client interceptor.
// There will be panic if options is an empty pointer.
func NewClientUnaryInterceptor(opts *Options) grpc.DialOption {
if opts == nil {
Expand Down
2 changes: 1 addition & 1 deletion inmemorycache.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (s *inMemoryCache) Get(key string) ([]byte, error) {
return nil, nil
}

// Makes a built-in LRU in-memory cache implementation
// NewInMemoryCache - makes a built-in LRU in-memory cache implementation
// aimed for small projects, MVP, etc.
func NewInMemoryCache(capacity uint) Cache {
return &inMemoryCache{
Expand Down
6 changes: 3 additions & 3 deletions metafilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

package care

// Header's pools for filtering.
// Headers is a pool for filtering.
type Headers struct {
// Headers for the key computation.
Allowed []string
// Omitted headers from the key computation.
Disallowed []string
}

// A 'MetaFilter' represents an interface for filtering the headers
// MetaFilter represents an interface for filtering the headers
// before including the once in the key computation.
//
// It can be useful if you need to pick up only a few header
Expand All @@ -24,7 +24,7 @@ type Headers struct {
// Having implemented your own version, you can control the headers
// which will be involved in the key computation process.
type MetaFilter interface {
// Returns true allowing to include the header in
// Allowed - returns true allowing to include the header in
// the key computation, otherwise returns false.
Allowed(key string, val []string) bool
}
Expand Down
7 changes: 4 additions & 3 deletions methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ import (
"time"
)

// 'Methods' represents an interface that allows to define
// Methods is representing an interface that allows to define
// the service's methods which responses you want to cache.
type Methods interface {
// Cacheable
// method - full method name
//
// Returns true and caching timeout if the method is found,
// otherwise false and timeout in this case does not matter.
Cacheable(method string) (bool, time.Duration)

// Allows to add method for caching.
// Add - allows to add method for caching.
// Returns the 'Methods' in order to be
// more convenient methods adding like a chain.
Add(method string, ttl time.Duration) Methods
// Remove the method from allowed to be cached.
Remove(method string)
// Removes all methods.
// Clean - removes all methods.
Clean()
}

Expand Down
4 changes: 2 additions & 2 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package care

// Memoization options. There are some options you can redefine
// Options - memoization options. There are some options you can redefine
// by your own implementation in order to have more flexibility.
// 'Options' gives enough room space to do that.
type Options struct {
Expand All @@ -20,7 +20,7 @@ type Options struct {
Cache Cache
}

// Makes a default options set, having filled
// NewOptions - makes a default options set, having filled
// all items by thread-safe implementations.
func NewOptions() *Options {
opts := Options{
Expand Down
2 changes: 1 addition & 1 deletion serverunaryinterceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (s *unaryServerInterceptor) Unary() grpc.UnaryServerInterceptor {
}
}

// Makes a new unary server interceptor.
// NewServerUnaryInterceptor - makes a new unary server interceptor.
// There will be panic if options is an empty pointer.
func NewServerUnaryInterceptor(opts *Options) grpc.ServerOption {
if opts == nil {
Expand Down
8 changes: 4 additions & 4 deletions switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"sync/atomic"
)

// A feature switch.
// Switch is a switch feature.
type Switch interface {
// Turns on the feature.
// TurnOn - turns on the feature.
TurnOn()
// Turns off the feature.
// TurnOff - turns off the feature.
TurnOff()

// Returns a state of the feature (turned on/off).
// IsTurnedOn - returns a state of the feature (turned on/off).
IsTurnedOn() bool
}

Expand Down
2 changes: 1 addition & 1 deletion zerometafilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func (s *zeroMetaFilter) Allowed(string, []string) bool {
return s.allowed
}

// Makes a zero-filter implementation. It can be used
// NewZeroMetaFilter - makes a zero-filter implementation. It can be used
// if you don't have any rule for header filtering.
//
// allowed - defines common behaviour for any header
Expand Down

0 comments on commit ff9826a

Please sign in to comment.