infinispan / infinispan/python-client

Cache should have dictionary-like syntactic sugar

未关闭
#1 0 条评论 0 个 reaction 已指派 1 人 已被 @galderz 认领 在 GitHub 查看
主要语言
C++
星标
17
派生
12
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。