@@ -44,21 +44,21 @@ type portsCache struct {
44
44
deletionCallback func (port * discovery.Port )
45
45
}
46
46
47
- // NewCache creates a new portsCache and returns it.
47
+ // newCache creates a new portsCache and returns it.
48
48
// itemsTTL is the TTL of a single item, when it's reached
49
49
// the stored item is deleted.
50
- func NewCache (itemsTTL time.Duration ) * portsCache {
50
+ func newCache (itemsTTL time.Duration ) * portsCache {
51
51
return & portsCache {
52
52
itemsTTL : itemsTTL ,
53
53
data : make (map [string ]* cacheItem ),
54
54
}
55
55
}
56
56
57
- // Set stores a new port and sets its TTL.
57
+ // set stores a new port and sets its TTL.
58
58
// If the specified key is already found the item's TTL is
59
59
// renewed.
60
- // Set is thread safe.
61
- func (c * portsCache ) Set (key string , port * discovery.Port ) {
60
+ // set is thread safe.
61
+ func (c * portsCache ) set (key string , port * discovery.Port ) {
62
62
c .dataMutex .Lock ()
63
63
defer c .dataMutex .Unlock ()
64
64
// We need a cancellable context to avoid leaving
@@ -105,10 +105,10 @@ func (c *portsCache) Set(key string, port *discovery.Port) {
105
105
}(key , item )
106
106
}
107
107
108
- // Get returns the item stored with the specified key and true.
108
+ // get returns the item stored with the specified key and true.
109
109
// If the item is not found returns a nil port and false.
110
- // Get is thread safe.
111
- func (c * portsCache ) Get (key string ) (* discovery.Port , bool ) {
110
+ // get is thread safe.
111
+ func (c * portsCache ) get (key string ) (* discovery.Port , bool ) {
112
112
c .dataMutex .Lock ()
113
113
defer c .dataMutex .Unlock ()
114
114
if item , ok := c .data [key ]; ok {
@@ -117,9 +117,9 @@ func (c *portsCache) Get(key string) (*discovery.Port, bool) {
117
117
return nil , false
118
118
}
119
119
120
- // Clear removes all the stored items and stops their TTL timers.
121
- // Clear is thread safe.
122
- func (c * portsCache ) Clear () {
120
+ // clear removes all the stored items and stops their TTL timers.
121
+ // clear is thread safe.
122
+ func (c * portsCache ) clear () {
123
123
c .dataMutex .Lock ()
124
124
defer c .dataMutex .Unlock ()
125
125
for key , item := range c .data {
0 commit comments