feedly允许您使用redis构建复杂的feed和缓存结构。

feedl的Python项目详细描述


流框架(以前是feedly)
[构建状态](https://travis-ci.org/tschellenbach/feedly.png?branch=master)"(https://travis ci.org/tschellenbach/feedly)

**注**


此项目以前命名为feedly。根据feedly.com的要求,我们现在已经将项目重命名为stream框架。



\##

feedly允许您使用cassandra和/或redis构建新闻提要和通知系统。
您可以构建的示例包括facebook新闻提要、twitter流或下一页的pinterest。
我们为[fashiolista][fashiolista]构建了feedly,它为[flat]提供动力。feed][fashiolista_flat]、[aggregated feed][fashiolista_aggregated]和[notification system][fashiolista_notification]。
(feed通常也称为:活动流、活动源、新闻流。)

[fashiolista]:http://www.fashiolista.com/
[stream]:http://getstream.io/
[stream戋js]:https://github.com/tschellenbach/stream js
[stream戋python]:https://github.com/tbarbugli/stream php
[stream戋ruby]:https://github.com/tbarbugli/stream ruby
[fashiolista戋flat]:http://www.fashiolista.com/饲料/?feed_type=f
[fashiolista_aggregated]:http://www.fashiolista.com/feed/?feed_type=a
[fashiolista_notification]:http://www.fashiolista.com/my_style/notification/
[example_app_link]:https://github.com/tbarbugli/feedly_pin/

为了让您快速熟悉feedly,我们创建了一个类似pinterest的示例应用程序,您可以找到它[这里][示例应用程序_ link]

getstream.io

stream framework的作者还提供了一个saas解决方案,用于在[getstream.io][stream]构建feed系统
托管服务高度优化,允许您立即开始构建应用程序。
这节省了维护cas的时间Sandra、Redis、Faye、Rabbitmq和芹菜工人。
客户可用于[node][stream_js]、[ruby][stream_ruby]、[python][stream_python]和[php][stream_php]




**作者**

*thierry schellenbach(thierry at getstream.io)
*tommaso barbugli(tommaso at getstream.io)
*guyon morée


**资源**

*[文档]
*[错误跟踪器]
*[代码]
*[邮件列表]
*[irc](irc.freenode.net),feedly python)
*[travis ci]


**教程**

*[Pinterest风格的feed示例应用程序][Mellowmorning示例]



[Mellowmorning示例]:http://www.mellowmorning.com/2013/10/18/scalable Pinterest教程Feedly Redis/
[文档]:https://feedly.readthedocs.org/
[bug tracker]:http://github.com/tschellenbach/feedly/issues
[代码]:http://github.com/tschellenbach/feedly
[邮件列表]:https://groups.google.com/group/feedly python
[irc]:irc://irc.freenode.net/feedly python
[travis ci]:http://travis-ci.org/tschellenbach/stream framework/


因此,让我们为刚刚固定的项创建一个活动。

`` python
def create_activity(pin):
来自feedly.activity import activity
activity=activity(
pin.user_id,
pinverb,
pin.id,
pin.influencer_id,
time=make_naive(pin.created_at,pytz.utc),
extra_context=dict(item_id=pin.item_id)
)return activity
````

下一步我们要开始在多个feed上发布此活动。
首先要将其插入到您的个人feed中,然后插入所有关注者。
让我们首先定义这些提要。

``` python
例如,要写入用户13的feed,可以执行

``python


feed=userpinfeed(13)
feed.add(activity)
````

我们希望发布到所有跟随您的用户的feed。
此操作称为扇出,并在feedly管理器类中抽象出来。
我们需要对feedly类进行子类划分,并告诉它如何确定哪些用户跟随我们。

``python

class pinfeedly(feedly):
feed_classes=dict(
normal=pinfeed,

user_feed_classes=userpinfeed

def add_pin(self,pin):
activity=pin.create_activity()
add user activity将其添加到用户feed,并启动扇出
self.add_user_a活动(pin.user_id,activity)

def get戋u user戋follower戋id(self,user戋id):
ids=follow.objects.filter(target=user戋id).values戋list('user戋id',flat=true)
返回{fanopupriority.high:ids}


feedly=pinfeedly()
`````

设置广播一个pin变得和feedly一样简单。添加pin(pin)将把pin插入到你的个人feed和所有跟随你的用户feed中。在django(或任何其他框架)中,您现在可以显示用户提要。

`` python
` django示例

@需要登录
定义提要(请求):
'
'
'
'
'
'
context=requestcontext(请求)
feed=feedly.get feeds(request.user.id)['normal']
activities=list(feed[:25])
context['activities']=activities
response=render_to_response('core/feed.html',context)
return response

`````

这个示例只简要介绍了流框架是如何工作的。
国家可以在阅读文档中找到。



不必等待)
-可重用组件(您需要根据您的用例进行权衡,流框架不会妨碍您)
-完全支持cassandra和redis
-cassandra存储使用新的cql3和python驱动程序包,使您能够访问最新的cAssandra的特色。
-专为性能卓越的Cassandra 2.0打造



基于s的数据库回退,与fashiolista的旧方法非常相似。

[twitter_]:http://highscalability.com/blog/2013/7/8/the-architecture-twitter-uses-to-deal-with-150m-active-users.html

[etsy feed scaling][etsy]
(gearman,单独的评分和聚合步骤,rolluPS-聚合第二部分)

[etsy]:http://www.slideshare.net/danmckinley/etsy activity feeds architecture/


[facebook]:http://www.infoq.com/presentations/facebook software stack
[facebook history][facebook]


[djproject]:http://justquick.github.com/django-activity stream/
[具有良好命名约定的django项目][djaproject]


[活动工作流]:http://activitystrea.ms/specs/atom/1.0/
[活动流规范][活动工作流]


[关于最佳实践的Quora帖子][Quora]

[Quora]:http://wwww.quora.com/what-are-best-practices-for-building-something-like-a-news-feed?q=news+feeds

[Quora扩展社交网络feed][Quora2]

[Quora2]:http://www.quora.com/what-are-the-scaling-issues-to-keep-in-mind-while-developing-a-social-network-feed

[Redis Ruby示例][RedisRuby]

[RedisRuby]:http://blog.waxman.me/how-to-build-a-fast-nredis中的ews feed

[friendfeed approach][friendfeed]

[friendfeed]:http://backchannel.org/blog/friendfeed schemales mysql

[thoonk setup][thoonk]

[thoonk]:http://blog.thoonk.com/

[yahoo研究论文]

[yahoo]:http://research.yahoo.com/files/sigmod278 silberstein.pdf

[twitter的方法][twitter]

[twitter]:http://www.slideshare.net/nkallen/q-con-3770885

[cassandra at instagram][instagram]

[instagram]:http://planetcassandra.org/blog/post/instagram-making-the-switch-to-cassandra-from-rediS-75-Instasavings公司

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何将UDP消息从桌面发送到移动设备?   java DefaultMessageListenerContainer使用JMX+ActiveMQ在单个队列上管理多个使用者   java CMU Sphinx:Voxforge德国型号不精确   java生成一个定制的lastIndexOf方法   java生成pdf PDFBox无头docker容器失败   java实例化HashMap中存储的类的实例   java将JAAS表单身份验证传递给REST服务   爪哇:Tomcat。伊奥。IOException:无法创建目标“xxx”目录“   java GoogleTokenResponse未执行。。!   java Lastmodified标头在第二次刷新后不工作   java Android onClickListener没有注册点击(我想)   当引导调用远程模式时,不会加载java Google reCaptcha   java将二进制字符串转换为字节数组   java为JPA本机查询的结果分配ID的最简单方法是什么?   java上的数组参数行为   组织中的java字段数据源。O7计划。关于公司。MainController需要“javax”类型的bean。sql。找不到“数据源”   java如何使用selenium在excel文件中查找字符串的位置   java Hibernate注释。如何注释?   在Java中反转字符串时出错