@@ -61,9 +61,9 @@ Refer to the section on [NewSession] for more information on setting up a SSL co
6161
6262# Obtaining a NamedMap or NamedCache
6363
64- Once a session has been created, the [NewNamedMap ](session, name, ...options) can be used to obtain
65- an instance of a [NamedMap]. The key and value types must be provided as generic type arguments.
66- This identifier may be shared across clients. It's also possible to have many [NamedMap]' s defined and in use simultaneously.
64+ Once a session has been created, the [GetNamedMap ](session, name, ...options) or [GetNamedCache](session, name, ...options)
65+ can be used to obtain an instance of a [NamedMap] or [NamedCache ]. The key and value types must be provided as generic type arguments.
66+ This identifier may be shared across clients. It's also possible to have many [NamedMap]s or [NamedCache] s defined and in use simultaneously.
6767
6868Example:
6969
@@ -73,14 +73,14 @@ Example:
7373 }
7474 defer session.Close()
7575
76- namedMap, err := coherence.NewNamedMap [int, string](session, "customers")
76+ namedMap, err := coherence.GetNamedMap [int, string](session, "customers")
7777 if err != nil {
7878 log.Fatal(err)
7979 }
8080
81- If you wish to create a [NamedCache], which supports expiry, you can use the [NewNamedCache ] function and then use the PutWithExpiry function call.
81+ If you wish to create a [NamedCache], which supports expiry, you can use the [GetNamedCache ] function and then use the PutWithExpiry function call.
8282
83- namedCache, err := coherence.NewNamedCache [int, string](session, "customers")
83+ namedCache, err := coherence.GetNamedCache [int, string](session, "customers")
8484 if err != nil {
8585 log.Fatal(err)
8686 }
@@ -91,7 +91,7 @@ If your [NamedCache] requires the same expiry for every entry, you can use the [
9191Each call to Put will use the default expiry you have specified. If you use PutWithExpiry, this will override the default
9292expiry for that key.
9393
94- namedCache, err := coherence.NewNamedCache [int, Person](session, "cache-expiry", coherence.WithExpiry(time.Duration(5)*time.Second))
94+ namedCache, err := coherence.GetNamedCache [int, Person](session, "cache-expiry", coherence.WithExpiry(time.Duration(5)*time.Second))
9595
9696See [SessionOptions] which lists all the options supported by the [Session] API.
9797
@@ -106,7 +106,7 @@ Assuming a very trivial [NamedMap] with integer keys and string values.
106106 log.Fatal(err)
107107 }
108108
109- namedMap, err := coherence.NewNamedMap [int, string](session, "my-map")
109+ namedMap, err := coherence.GetNamedMap [int, string](session, "my-map")
110110 if err != nil {
111111 log.Fatal(err)
112112 }
@@ -151,7 +151,7 @@ if you wish to store structs as native Java objects, then please see the section
151151 }
152152
153153 // create a new NamedMap of Person with key int
154- namedMap, err := coherence.NewNamedMap [int, Person](session, "test")
154+ namedMap, err := coherence.GetNamedMap [int, Person](session, "test")
155155 if err != nil {
156156 log.Fatal(err)
157157 }
@@ -161,7 +161,7 @@ if you wish to store structs as native Java objects, then please see the section
161161 log.Fatal(err)
162162 }
163163
164- newPerson := Person{ID: 1, Name: "Tim", Age: 53 }
164+ newPerson := Person{ID: 1, Name: "Tim", Age: 21 }
165165 fmt.Println("Add new Person", newPerson)
166166 if _, err = namedMap.Put(ctx, newPerson.Id, newPerson); err != nil {
167167 log.Fatal(err)
@@ -195,7 +195,7 @@ Key and/or a Value. As always, the Err object must be checked for errors before
195195All functions that return channels are EntrySetFilter, KeySetFilter, ValuesFilter,
196196EntrySet, KeySet, Values, InvokeAll and InvokeAllFilter.
197197
198- namedMap, err := coherence.NewNamedMap [int, Person](session, "people")
198+ namedMap, err := coherence.GetNamedMap [int, Person](session, "people")
199199 if err != nil {
200200 log.Fatal(err)
201201 }
@@ -234,7 +234,7 @@ run various scenarios to increase peoples salary by using a [processors.Multiply
234234 City string `json:"city"`
235235 }
236236
237- namedMap, err := coherence.NewNamedMap [int, Person](session, "people")
237+ namedMap, err := coherence.GetNamedMap [int, Person](session, "people")
238238
239239 // 1. Increase the salary of the person with Id = 1
240240 newSalary, err = coherence.Invoke[int, Person, float32](ctx, namedMap, 1, processors.Multiply("salary", 1.1, true))
@@ -266,7 +266,7 @@ large amounts of data.
266266To demonstrate this, lets assume we have a [NamedMap] populated with Person struct as per the previous example, and we want to
267267run various scenarios to perform aggregations.
268268
269- namedMap, err := coherence.NewNamedMap [int, Person](session, "people")
269+ namedMap, err := coherence.GetNamedMap [int, Person](session, "people")
270270 if err != nil {
271271 log.Fatal(err)
272272 }
@@ -296,7 +296,7 @@ that occur against a [NamedMap] or [NamedCache]. You can listen for all events,
296296vents based upon a key.
297297
298298 // in your main code, create a new NamedMap and register the listener
299- namedMap, err := coherence.NewNamedMap [int, Person](session, "people")
299+ namedMap, err := coherence.GetNamedMap [int, Person](session, "people")
300300 if err != nil {
301301 log.Fatal(err)
302302 }
@@ -359,7 +359,7 @@ that occur against a [NamedMap] or [NamedCache].
359359
360360 // consider the example below where we want to listen for all 'truncate' events for a NamedMap.
361361 // in your main code, create a new NamedMap and register the listener
362- namedMap, err := coherence.NewNamedMap [int, Person](session, "people")
362+ namedMap, err := coherence.GetNamedMap [int, Person](session, "people")
363363 if err != nil {
364364 log.Fatal(err)
365365 }
@@ -373,7 +373,7 @@ that occur against a [NamedMap] or [NamedCache].
373373 namedMap.AddLifecycleListener(listener)
374374 defer namedMap.RemoveLifecycleListener(listener)
375375
376- newPerson := Person{ID: 1, Name: "Tim", Age: 53 }
376+ newPerson := Person{ID: 1, Name: "Tim", Age: 21 }
377377 fmt.Println("Add new Person", newPerson)
378378 if _, err = namedMap.Put(ctx, newPerson.Id, newPerson); err != nil {
379379 log.Fatal(err)
@@ -421,7 +421,7 @@ in your main code, create a new [Session] and register the listener
421421 defer session.RemoveSessionLifecycleListener(listener)
422422
423423 // create a new NamedMap of Person with key int
424- namedMap, err := coherence.NewNamedMap [int, Person](session, "people")
424+ namedMap, err := coherence.GetNamedMap [int, Person](session, "people")
425425 if err != nil {
426426 log.Fatal(err)
427427 }
0 commit comments