infinispan / infinispan/python-client

Cache should have dictionary-like syntactic sugar

Offen
#1 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @galderz Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
17
Forks
12
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

The Cache class uses Java Map-style put(), get(), remove() and contains(). Which is fine, but we should also offer Python-style syntactic sugar, so that we can do:

```
cache['key'] = 'value'
print cache['key']
if 'key' in cache:
print 'Key exists!'
for e in cache:
print e
```

etc. Have a look at the implementation of a Python map for more details, or one of the many custom map-like classes available for Python.

This is usually implemented by defining internal methods, such as:

```
def __getitem__(self, key):
return self.get(key)

def __setitem__(self, key, value):
self.put(key, value)
```

etc.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.