我看过FatFree Framework的作者发布的关于在路由和框架变量中设置缓存值的示例:
[globals]
foo=bar,86400 // variable cached for 24 hours
[routes]
GET /foo=Bar->baz,3600 // route cached for 1 hour
但是在Fat Free Framework文档中,我们有这个例子来设置数组
; this is also an array
items=7,8,9
; array with mixed elements
mix="this",123.45,FALSE
所以,我的问题是,我如何区分如果我想要一个值缓存或数组?
[globals]
节中逗号分隔的值表示数组仅。
看起来@bcosca写错了他的评论。全局变量的缓存语法不能与当前的代码库一起工作(在内部set
方法被调用时只有2个参数)。
为了使事情更清楚,下面是逗号在这两个部分中的含义:
[globals]
foo=bar,86400 //define an array
[routes]
GET /foo=Bar->baz,3600 //cache route for 1h
GET /foo=Bar->baz,0,56 //limits bandwith to 56 kps
也就是说,前面的配置文件相当于:
$f3->set('foo',array('bar',86400));
$f3->route('GET /foo','Bar->baz',3600);
$f3->route('GET /foo','Bar->baz',0,56);