pyla是一个基于redis的存储系统
pyla的Python项目详细描述
Pyla是一个基于redis的存储系统,它可以根据项目的 属性。
在当前版本中,它将条目的信息存储在排序集中 所有信息都在钥匙里。
为什么是派拉?
假设你有一些你想安排的工作,每个工作都有 与之关联的属性。
frompylaimportentriesfrompylaimportfieldsclassJob(entries.Entry):id=fields.BaseField(primary=True)type=fields.BaseField(index=True)assigned_to=fields.BaseField(index=True)info=fields.BaseField(index=False)j=Job(id=1,type='create',assigned_to='dush',info='testing')j.save()
在对该特定条目调用save时,将对以下内容进行排序 redis中提供的集合
job job:type:create job:assigned_to:dush
那么你就拥有了以下出色的过滤能力:
# Get all the jobsJob.objects.all()# Get jobs with type createJob.objects.filter(type='create')# Get jobs with either create or delete typeJob.objects.filter(type=['create','delete'])# Get jobs which are assigened to dushJob.objects.filter(assigned_to='dush')# Get jobs which are assigened to dush or spamJob.objects.filter(assigned_to=['dush','spam'])# Get jobs which are assigened to dush and are of type createJob.objects.filter(assigned_to='dush',type='create')# Get jobs which are assigened to dush and are of type create or deleteJob.objects.filter(assigned_to='dush',type=['create','delete'])# Get jobs which are assigened to dush or spam and are of type create or deleteJob.objects.filter(assigned_to=['dush','spam'],type=['create','delete'])
可以对设置为索引的字段使用任意数量的筛选器。 显然,索引越多,写得越慢。