在 php 中强制重新缓存 WSDL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/323561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 22:23:40  来源:igfitidea点击:

Force re-cache of WSDL in php

phpweb-servicescachingwsdl

提问by qualbeen

I know how to disable WSDL-cachein PHP, but what about force a re-caching of the WSDL?

我知道如何在 PHP 中禁用WSDL 缓存,但是强制重新缓存 WSDL 怎么样?

This is what i tried: I run my code with caching set to disabled, and the new methods showed up as espected. Then I activated caching, but of some reason my old non-working wsdl showed up again. So: how can I force my new WSDL to overwrite my old cache?

这就是我尝试过的:我在缓存设置为禁用的情况下运行我的代码,并且新方法按预期显示。然后我激活了缓存,但由于某种原因,我的旧的非工作 wsdl 再次出现。那么:如何强制我的新 WSDL 覆盖我的旧缓存?

回答by Tom Haigh

I guess when you disable caching it will also stop writing to the cache. So when you re-enable the cache the old cached copy will still be there and valid. You could try (with caching enabled)

我猜当您禁用缓存时,它也会停止写入缓存。因此,当您重新启用缓存时,旧的缓存副本仍然存在且有效。您可以尝试(启用缓存)

ini_set('soap.wsdl_cache_ttl', 1);

I put in a time-to-live of one second in because I think if you put zero in it will disable the cache entirely but not remove the entry. You probably will only want to put that line in when you want to kill the cached copy.

我输入了 1 秒的生存时间,因为我认为如果你输入零,它将完全禁用缓存但不会删除条目。您可能只想在要终止缓存副本时放入该行。

回答by G Mawr

In my php.ini there's an entry which looks like this:

在我的 php.ini 中有一个条目,如下所示:

soap.wsdl_cache_dir="/tmp"

In /tmp, I found a bunch of files named wsdl-[some hexadecimal string]

在/tmp中,我发现了一堆名为wsdl-[一些十六进制字符串]的文件

I can flush the cached wsdl files with this command:

我可以使用以下命令刷新缓存的 wsdl 文件:

rm /tmp/wsdl-*

回答by foxy

Delete the old WSDL from the cache.

从缓存中删除旧的 WSDL。

回答by Greg

I'd try

我会尝试

$limit = ini_get('soap.wsdl_cache_limit');
ini_set('soap.wsdl_cache_limit', 0);
ini_set('soap.wsdl_cache_limit', $limit);

Or possibly set soap.wsdl_cache_ttlto 0 and back

或者可能设置soap.wsdl_cache_ttl为 0 并返回