首页 \ 问答 \ 在Booksleve中的Redis交易(Redis transactions in Booksleve)

在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
更新时间:2022-09-01 14:09

最满意答案

在初始化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. ...
  • 你有两个选择...... 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。 没有一些示例代码,我不知道具体的元素,但其实质是:
    对于上面简单的标记,只需使用以下CSS: .parent .navigation-links { display:none; } .parent:hover .navigation-links { display: ...
  • 图像的位置正在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之前添加此代码,并使用triangleNodePrev / Next替换参数。 这具有禁用链接上的默认操作的优点,因此,如果您使用href =“#”,则浏览器不会滚动回页面的顶部。 $('#previousButton, #nextButton').on('click', function (e) { // Prevent the link from being followed e.preventDefault(); ...
  • 打开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滑块正式宣布响应,这是宣布。 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 ...
  • 使用计时器控件,并从xml文件加载图像,例如从xml Web服务加载它。 然后定义一个转换,每次加载新图像时都会触发转换。 当用户选择手动滚动图像时,请停止计时器。 只需单击Add Data菜单,然后选择XML(本地文件),然后按照向导进行操作。 样本: http : //forums.adobe.com/thread/502852 在加载的偶数加载的XML数据文件上,启动计时器,开始加载图像。 使用本教程作为示例定义过渡: http://hkcoding.wordpress.com/2011/08/25/ ...
  • 我不知道您的确切代码,但您可以在其上使用.stop(),并在5秒后再次启动它。 。$( '#滑块')的数据( 'nivoslider')停止(); //停止Slider $('#slider')。data('nivoslider')。delay(5000).start(); //启动滑块 更正(因为延迟在这种情况下不起作用): $(window).load(function(){ $('#slider').nivoSlider({ animSpeed: 500, pauseTime: 400 ...

相关文章

更多

最新问答

更多
  • python的访问器方法有哪些
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。
  • 响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)
  • 在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)
  • NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)
  • 元素上的盒子阴影行为(box-shadow behaviour on elements)
  • Laravel检查是否存在记录(Laravel Checking If a Record Exists)
  • 设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
  • 想学Linux 运维 深圳有哪个培训机构好一点
  • 为什么有时不需要在lambda中捕获一个常量变量?(Why is a const variable sometimes not required to be captured in a lambda?)
  • 在Framework 3.5中使用服务器标签<%=%>设置Visible属性(Set Visible property with server tag <%= %> in Framework 3.5)
  • AdoNetAppender中的log4net连接类型无效(log4net connection type invalid in AdoNetAppender)
  • 错误:发送后无法设置标题。(Error: Can't set headers after they are sent. authentication system)
  • 等待EC2实例重启(Wait for an EC2 instance to reboot)
  • 如何在红宝石中使用正则表达式?(How to do this in regex in ruby?)
  • 使用鼠标在OpenGL GLUT中绘制多边形(Draw a polygon in OpenGL GLUT with mouse)
  • 江民杀毒软件的KSysnon.sys模块是什么东西?
  • 处理器在传递到add_xpath()或add_value()时调用了什么顺序?(What order are processors called when passed into add_xpath() or add_value()?)
  • sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
  • 如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
  • AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
  • SQL查询,其中字段不包含$ x(SQL Query Where Field DOES NOT Contain $x)
  • PerSession与PerCall(PerSession vs. PerCall)
  • C#:有两个构造函数的对象:如何限制哪些属性设置在一起?(C#: Object having two constructors: how to limit which properties are set together?)
  • 平衡一个精灵(Balancing a sprite)
  • n2cms Asp.net在“文件”菜单上给出错误(文件管理器)(n2cms Asp.net give error on Files menu (File Manager))
  • Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
  • 湖北京山哪里有修平板计算机的