我正在尝试在Web API中缓存ApiController方法的输出.
这是控制器代码:
public class TestController : ApiController
{
[OutputCache(Duration = 10, VaryByParam = "none", Location = OutputCacheLocation.Any)]
public string Get()
{
return System.DateTime.Now.ToString();
}
}
Run Code Online (Sandbox Code Playgroud)
NB我还尝试了控制器本身的OutputCache属性,以及它的几个参数组合.
该路线在Global.asax中注册:
namespace WebApiTest
{
public class Global : HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapHttpRoute("default", routeTemplate: "{controller}");
}
}
}
Run Code Online (Sandbox Code Playgroud)
我得到了一个成功的回复,但它没有缓存在任何地方:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/xml; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 18 Jul 2012 17:56:17 GMT
Content-Length: 96 …
Run Code Online (Sandbox Code Playgroud) 有没有办法检索在外部网站上点击了类似按钮的Facebook用户列表?
我想明白的是,喜欢的用户列表example.com/xyz和那些谁喜欢的example.com/abc.
我的直观方法是查看graph.facebook.com/123456789/likes(其中数字是从FB洞察中获取的域的ID),但这总是返回一个空数据集:
{
"data": [
]
}
Run Code Online (Sandbox Code Playgroud)
我还尝试从https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=APPID&client_secret=APPSECRET获取OAuth访问令牌(其中APPID和APPSECRET来自标记为拥有域的FB应用程序使用OG元标记),但没有区别.
我也对非OpenGraph(即JS SDK,FQL等)解决方案感兴趣.
编辑:使用下面的代码(根据WideBlade的答案)仍然给我一个空的列表(第二个查询永远不会返回):
var objectsQuery = "select id from object_url where url in ('http://example.com/xyz', 'http://example.com/abc', 'http://example.com/123')";
var likesQuery = "select object_id from like where object_id = {0}";
FB.Data.query(objectsQuery).wait(function (objectRows) {
console.log(objectRows);
FB.Array.forEach(objectRows, function (objectRow) { …
Run Code Online (Sandbox Code Playgroud)