首页 \ 问答 \ 在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 ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)