在Booksleve中的Redis交易(Redis transactions in Booksleve)
下面的3个命令按原样执行时效果很好。
using (var redis = NewRedisConnection) { await redis.Open(); var allKeys = await redis.Keys.Find(db, "searchPattern"); var allVals = await redis.Strings.GetString(db, allKeys); await redis.Keys.Remove(db, allKeys); //process the data I pull from redis }
但是当我尝试将它们包装在一个事务中时它就会停止工作。 不抛出异常,但如果我调试执行似乎停止在
var allKeys = ...
我在设置事务时错过了什么?using (var redis = NewRedisConnection) { await redis.Open(); var tran = redis.Createtransaction(); var allKeys = await tran.Keys.Find(db, "searchPattern"); var allVals = await tran.Strings.GetString(db, allKeys); await tran.Keys.Remove(db, allKeys); await tran.Execute(); //process the data I pull from redis }
The 3 commands below work perfectly when they are executed as is.
using (var redis = NewRedisConnection) { await redis.Open(); var allKeys = await redis.Keys.Find(db, "searchPattern"); var allVals = await redis.Strings.GetString(db, allKeys); await redis.Keys.Remove(db, allKeys); //process the data I pull from redis }
But when I try to wrap them in a transaction it stops working. Exceptions aren't thrown, but if I debug the execution seems to stop at
var allKeys = ...
Am I missing something While setting up the transaction?using (var redis = NewRedisConnection) { await redis.Open(); var tran = redis.Createtransaction(); var allKeys = await tran.Keys.Find(db, "searchPattern"); var allVals = await tran.Strings.GetString(db, allKeys); await tran.Keys.Remove(db, allKeys); await tran.Execute(); //process the data I pull from redis }
原文:https://stackoverflow.com/questions/13435797
最满意答案
在初始化Nivo Slider之前添加此代码,并使用triangleNodePrev / Next替换参数。 这具有禁用链接上的默认操作的优点,因此,如果您使用href =“#”,则浏览器不会滚动回页面的顶部。
$('#previousButton, #nextButton').on('click', function (e) { // Prevent the link from being followed e.preventDefault(); // Initialize variables var buttonId = this.id, buttonClass = ('previousButton' == buttonId) ? '.nivo-prevNav' : '.nivo-nextNav'; // Trigger the slider button $('.nivo-directionNav').find(buttonClass).click(); });
Add this code before you initialize Nivo Slider and replace the parameters with your triangleNodePrev / Next. This has the advantage of disabling the default action on your links so that if you use href="#" the browser doesn't scroll back to the top of the page.
$('#previousButton, #nextButton').on('click', function (e) { // Prevent the link from being followed e.preventDefault(); // Initialize variables var buttonId = this.id, buttonClass = ('previousButton' == buttonId) ? '.nivo-prevNav' : '.nivo-nextNav'; // Trigger the slider button $('.nivo-directionNav').find(buttonClass).click(); });
相关问答
更多-
我相信IE的盒子模型会混淆Nivo代码。 添加这个CSS规则似乎解决了这个问题: #slider { height: 355px; } I believe something about IE's box model confuses the Nivo code. Adding this CSS rule seems to fix it: #slider { height: 355px; }
-
jQuery没有被加载到页面上。 这就是你试图加载它的方式: Firebug显示这个URL是实际请求的内容: http://bikeshop.gostorego.com/%E2%80%99https://ajax.googleapis.com/ajax/libs/jquery/1.5. ...
-
Nivo滑块不居中(Nivo Slider is not centered)[2022-04-17]
你有两个选择...... a:执行软件的设计并使用图像的确切大小。 b:从滑块本身中删除边框样式和阴影,并将其应用于图像。 然后使用一些CSS样式来居中图像。 #slider img{ margin-left:0 auto; margin-right:0 auto; } 基本上,隐藏滑块div的所有痕迹,只是将图像居中。 这将是奇怪的,但如果那就是你想要的,那么你也会有更多的力量。 You have two options... a: Do what the software was de ... -
你可以使用一些CSS。 没有一些示例代码,我不知道具体的元素,但其实质是:
-
图像的位置正在JavaScript文件中加载。 编辑“jquery.nivo.slider.js”(请确保在标题中使用此文件而不是“jquery.nivo.slider.pack.js”。) 转到第85行: //Set first background slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); 找到上面的行。 将其更改为: //Set first background ...
-
Nivo Slider(raphaeljs)的外部控件(Next / Prev)?(External Controls (Next / Prev) for Nivo Slider (raphaeljs)?)[2023-04-15]
在初始化Nivo Slider之前添加此代码,并使用triangleNodePrev / Next替换参数。 这具有禁用链接上的默认操作的优点,因此,如果您使用href =“#”,则浏览器不会滚动回页面的顶部。 $('#previousButton, #nextButton').on('click', function (e) { // Prevent the link from being followed e.preventDefault(); ... -
nivo滑块,是一种总是显示下一个和prev箭头的方法吗?(nivo slider, is a way to always show the next and prev arrows?)[2023-06-04]
打开nivoslider js文件并找到 {A( “NIVO-directionNav”,F).hide(); f.hover(函数(){A( “NIVO-directionNav。”,F).show()},函数(){A(”。 NIVO-directionNav”,F).hide()} 改成 {A( “NIVO-directionNav”,F).show(); f.hover(函数(){A( “NIVO-directionNav。”,F).show()},函数(){A(”。 NIVO-directionNa ... -
如何使Nivo滑块响应(How to make Nivo Slider Responsive)[2023-04-12]
nivo滑块正式宣布响应,这是宣布。 http://nivo.dev7studios.com/2012/05/30/the-nivo-slider-is-responsive/ 演示: http://nivo.dev7studios.com/responsive-demo/ It was officially announced by nivo slider that it is responsive, Here is announcement. http://nivo.dev7studios.com/20 ... -
使用Flash Builder创建像Nivo滑块一样的图像滑块(Create Image Slider Like Nivo Slider With Flash Builder)[2022-11-27]
使用计时器控件,并从xml文件加载图像,例如从xml Web服务加载它。 然后定义一个转换,每次加载新图像时都会触发转换。 当用户选择手动滚动图像时,请停止计时器。 只需单击Add Data菜单,然后选择XML(本地文件),然后按照向导进行操作。 样本: http : //forums.adobe.com/thread/502852 在加载的偶数加载的XML数据文件上,启动计时器,开始加载图像。 使用本教程作为示例定义过渡: http://hkcoding.wordpress.com/2011/08/25/ ... -
暂停Nivo滑块(Pause Nivo Slider)[2021-10-13]
我不知道您的确切代码,但您可以在其上使用.stop(),并在5秒后再次启动它。 。$( '#滑块')的数据( 'nivoslider')停止(); //停止Slider $('#slider')。data('nivoslider')。delay(5000).start(); //启动滑块 更正(因为延迟在这种情况下不起作用): $(window).load(function(){ $('#slider').nivoSlider({ animSpeed: 500, pauseTime: 400 ...