Timestamping Records

本文介绍如何利用ActiveRecord的before_create和before_update回调来自动更新数据库表中的created_at和updated_at字段,确保时间戳的准确性和一致性。此外,还介绍了如何配置ActiveRecord以使用UTC时间。
before_create 和before_update 回调有种潜在的用法是timestamping 行。
class Order < ActiveRecord::Base
def before_create
self.order_created ||= Time.now
end
def before_update
self.order_modified = Time.now
end
end
“活动记录”可以不让你操心这些事。如果你的数据库表有个列名为created_at 或
created_on,它会自动地设置行创建时间的时间戳(timestamp)。同样地,一个列名字为
updated_at 或updated_on 将设置最后修改的时间戳。这些时间戳缺省地是本地时间;要使
用UTC(或GMT),在你的代码包括下面行(即可以内联独立的“活动记录”应用程序,也可以
用在完整的Rails 应用程序的环境文件中)。
ActiveRecord::Base.default_timezone = :utc
可以像下面这样取消它
ActiveRecord::Base.record_timestamps = false
IPFIX Support Observation Points IPFIX flow monitoring is performed per observation point. An observation point is the location where IP packets are probed and monitored. The device allows a flexible configuration of the IPFIX monitoring observation points. IPFIX flow classification is performed in the Policy engines. Observation points can be either on the Ingress or on the Egress. Using the Policy engines for flow classification allows high flexibility in the classification criteria. All packets in a flow share a set of common properties. These properties can include any of the Policy key fields. Typical fields that are used for IPFIX flow classification: Port IP version Source IP address Destination IP address Protocol type L4 ports DSCP L2 properties: such as VLAN, SA, DA Configuration Call cpssDxChPclRuleSet to set a Policy Rule Mask, Pattern and Action to the required match for flow classification. For a detailed description of policy configuration, see Policy Engine. Flow Records The IPFIX standard defines a flow record, which is a set of interesting properties of the flow that are maintained by the application. The application maintains a flow record for every active flow in the system, that is, for every flow that has a corresponding rule in the TCAM rule (see Dynamic Flow Classification). Properties that a flow record typically maintains include the fields specified above. In addition, the flow record typically includes: Packet counters and drop counters Timestamp of the first and last packet in the flow Other fields from the L3 or L4 headers Capture of the first packet in the flow Packet and drop counters, as well as timestamping are maintained and updated by the device on a per-flow base, and are periodically read by the application.
最新发布
10-22
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值