从 Catalyst::Plugin::Cache::FileCache 升级到 Catalyst::Plugin::Cache
我正在编写一个构建脚本来构建 Catalyst 应用程序,显然它是一个较旧的应用程序,因为它使用 Catalyst::Plugin::Cache::FileCache 而不是支持 FileCache 选项的较新的 Catalyst::Plugin::Cache 。通过 Makefile.PL 进行构建时,我无法使用 cpanm,因为 Catalyst::Plugin::Cache::FileCache 不再可检索。 :-(
找到实现这一点的方法对我来说是有问题的。
我想我可以更改应用程序以使用 Catalyst::Plugin::Cache 但我没有找到清晰的文档或任何简单的方法目前
该应用程序使用此...
__PACKAGE__->config( name => 'Stats', cache =>{storage=>'./tmp'} );
http://搜索。 cpan.org/~mramberg/Catalyst-Plugin-Cache-FileCache-0.7/lib/Catalyst/Plugin/Cache/FileCache.pm 是以下文档已弃用的模块。
Catalyst::Plugin::Cache 的新文档在这里..... http://metacpan.org/pod/Catalyst::Plugin::Cache
在我的一个模型中,我有这个......
__PACKAGE__->config(
schema_class => 'Schema::STATS',
connect_info => [
'dbi:ODBC:DSN=....;driver=...;Server=...;database=...;RB_CONFIG=...;',
'USER',
'PASS',
{limit_dialect=>'GenericSubQ',
on_connect_do => ['set dateformat ymd'],
cursor_class => 'DBIx::Class::Cursor::Cached'
}
],
);
sub COMPONENT {
my $self = shift->NEXT::COMPONENT(@_);
$self->schema->default_resultset_attributes({ cache_object => Cache::FileCache->
new({ namespace => 'Schema::STATS' }), cache_for=>3600});
return $self;
}
我现在希望做尽可能少的更改这个应用程序,但有人知道有什么更简单的方法可以进行一些更改,我需要切换到较新的 Catalyst::Plugin::Cache 吗?
更糟糕的是,我总是可以打包旧的 Catalyst::Plugin::Cache: :FileCache 源并安装它,但我希望有一种更简单的方法来使用新的。
非常感谢! 珍妮
I am writing a build script to build a Catalyst app and apparently it's an older app since it uses Catalyst::Plugin::Cache::FileCache instead of the newer Catalyst::Plugin::Cache which supports a FileCache option. When doing a build through Makefile.PL I can't use cpanm because Catalyst::Plugin::Cache::FileCache is no longer retrievable. :-(
Finding the way to do that is what is proving problematic for me though.
I suppose I could make changes to the app to use Catalyst::Plugin::Cache but I'm not finding the documentation clear, or any easy way to do it.
Currently the app uses this....
__PACKAGE__->config( name => 'Stats', cache =>{storage=>'./tmp'} );
http://search.cpan.org/~mramberg/Catalyst-Plugin-Cache-FileCache-0.7/lib/Catalyst/Plugin/Cache/FileCache.pm is the documentation for the deprecated module.
The new documentation for Catalyst::Plugin::Cache is here..... http://metacpan.org/pod/Catalyst::Plugin::Cache
In one of my models, I have this....
__PACKAGE__->config(
schema_class => 'Schema::STATS',
connect_info => [
'dbi:ODBC:DSN=....;driver=...;Server=...;database=...;RB_CONFIG=...;',
'USER',
'PASS',
{limit_dialect=>'GenericSubQ',
on_connect_do => ['set dateformat ymd'],
cursor_class => 'DBIx::Class::Cursor::Cached'
}
],
);
sub COMPONENT {
my $self = shift->NEXT::COMPONENT(@_);
$self->schema->default_resultset_attributes({ cache_object => Cache::FileCache->
new({ namespace => 'Schema::STATS' }), cache_for=>3600});
return $self;
}
I'm looking to make as few changes as possible right now to this app but is anyone aware of any easier way to make the couple of changes I need to switch to the newer Catalyst::Plugin::Cache?
Worse comes to worse I could always just package the older Catalyst::Plugin::Cache::FileCache source and install it but I was hoping there would just be an easier way to to use the new one.
Many thanks!
Janie
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
删除
Plugin::Cache::FileCache
并添加Plugin::Cache
应该可以完成大约 90% 的工作。$c->cache
将继续按您的预期工作,并且它将是一个普通的Cache::FileCache
对象。and removing
Plugin::Cache::FileCache
and addingPlugin::Cache
should get you about 90% of the way there.$c->cache
will keep working as you expect, and it will be a vanillaCache::FileCache
object.