Giter VIP home page Giter VIP logo

nservicekit.redis's Introduction

NServiceKit is a FREE and Open Source fork of ServiceStack.

Our goal is to keep the foundation for great REST Services on .NET free, open source and supported by the community. Accepting pull requests, issues on github: [https://github.com/NServiceKit/NServiceKit]

Follow @NServiceKit for updates!

Previous Documentation:

See www.servicestack.net for an overview.

Join the ServiceStack Google+ Community or follow @ServiceStack for project updates. You can catch some community members hanging out on JabbR.

Service Stack is a high-performance .NET web services platform that simplifies the development of high-performance REST (JSON, XML, JSV, HTML, MsgPack, ProtoBuf, CSV) and WCF SOAP Web Services.

Note: the source code is provided as-is - no direct or commercial support is available for ServiceStack

Improvements on ServiceStack

Simple REST service example

This example is also available as a stand-alone integration test:

//Web Service Host Configuration
public class AppHost : AppHostHttpListenerBase
{
    public AppHost() : base("TODOs Tests", typeof(Todo).Assembly) {}

    public override void Configure(Container container)
    {
        container.Register(new TodoRepository());
    }
}

//REST Resource DTO
[Route("/todos")]
[Route("/todos/{Ids}")]
public class Todos : IReturn<List<Todo>>
{
    public long[] Ids { get; set; }
    public Todos(params long[] ids)
    {
        this.Ids = ids;
    }
}

[Route("/todos", "POST")]
[Route("/todos/{Id}", "PUT")]
public class Todo : IReturn<Todo>
{
    public long Id { get; set; }
    public string Content { get; set; }
    public int Order { get; set; }
    public bool Done { get; set; }
}

public class TodosService : Service
{
    public TodoRepository Repository { get; set; }  //Injected by IOC

    public object Get(Todos request)
    {
        return request.Ids.IsEmpty()
            ? Repository.GetAll()
            : Repository.GetByIds(request.Ids);
    }

    public object Post(Todo todo)
    {
        return Repository.Store(todo);
    }

    public object Put(Todo todo)
    {
        return Repository.Store(todo);
    }

    public void Delete(Todos request)
    {
        Repository.DeleteByIds(request.Ids);
    }
}

Calling the above TODO REST service from any C#/.NET Client

//no code-gen required, can re-use above DTO's

var restClient = new JsonServiceClient(BaseUri);
List<Todo> all = restClient.Get(new Todos());     		// Count = 0

var todo = restClient.Post(
    new Todo { Content = "New TODO", Order = 1 }); 	    // todo.Id = 1
all = restClient.Get(new Todos());						// Count = 1

todo.Content = "Updated TODO";
todo = restClient.Put(todo);							// todo.Content = Updated TODO

restClient.Delete(new Todos(todo.Id));
all = restClient.Get(new Todos());						// Count = 0

Calling the TODO REST service from jQuery

$.getJSON(baseUri, function(todos) {
	alert(todos.length == 1);
});

Calling the TODO REST service from Dart JsonClient

var client = new JsonClient(baseUri);
client.todos()
	.then((todos) => alert(todos.length == 1) ); 

That's all the application code required to create a simple REST web service.

Getting Started

Download

If you have NuGet installed, the easiest way to get started is to install ServiceStack via NuGet:

NServiceKit binaries only: Minimal installation of ServiceStack containing only the core-binaries (.NET 3.5+) Install-Pacakage NServiceKit

NServiceKit with Razor Support: Create an empty ASP.NET Web or Console Application and (.NET 4.0+) Install-Pacakage NServiceKit.Razor2

Note: the binary packages are provided as-is - no direct or commercial support is available for ServiceStack

Examples

The Definitive list of Example Projects, Use-Cases, Demos, Starter Templates

Download published NuGet binaries without NuGet

GitHub has disabled its download feature so currently NuGet is the best way to get NServiceKit published releases. For environments that don't have NuGet installed (e.g. OSX/Linux) you can still download the published binaries by extracting them from the published NuGet packages. The url to download a nuget package is:

http://packages.nuget.org/api/v1/package/{PackageName}/{Version}

So to get the core ServiceStack and ServiceStack.Text libs in OSX/Linux (or using gnu tools for Windows) you can just do:

wget -O ServiceStack http://packages.nuget.org/api/v1/package/ServiceStack/3.9.60
unzip ServiceStack 'lib/*'

wget -O ServiceStack.Text http://packages.nuget.org/api/v1/package/ServiceStack.Text/3.9.60
unzip ServiceStack.Text 'lib/*'

which will download and extract the dlls into your local local lib/ folder.

Release notes for major releases

OSS Libraries used

ServiceStack includes source code of the great libraries below for some of its core functionality. Each library is released under its respective licence:

Similar open source projects

Similar Open source .NET projects for developing or accessing web services include:

  • Nancy Fx - A Sinatra-inspired lightweight Web Framework for .NET:
  • Fubu MVC - A "Front Controller" pattern-style MVC framework designed for use in web applications built on ASP.NET:
  • Rest Sharp - An open source REST client for .NET

Find out More

Follow @ServiceStack and +ServiceStack for project updates.


NServiceKit Core Team

ServiceStack Core Team

ServiceStack Contributors

A big thanks to GitHub and all of ServiceStack's contributors:


Runs on both Mono and .NET (Live preview hosted on Mono / Ubuntu)

nservicekit.redis's People

Contributors

alexvodovoz avatar bculberson avatar bosima avatar catlion avatar cbarbara avatar danbarua avatar dcartoon avatar desunit avatar dortzur avatar friism avatar gdassac avatar johngibb avatar johnsheehan avatar joplaal avatar kcherenkov avatar kevingessner avatar kumarnitin avatar lhaussknecht avatar mcduck76 avatar mikkelfish avatar mirthy avatar msarchet avatar mythz avatar paulduran avatar pinscript avatar robertmircea avatar steff-mueller avatar stevegraygh avatar vdaron avatar yurigorokhov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nservicekit.redis's Issues

Build Solution fails in VS2010 or Monodevelop on clean clone

Steps to reproduce:

  1. Clone repo in Windows or Linux.
  2. Open solution file: ./src/NServiceKit.Redis.sln in Monodevelop or VS2010.
  3. Build.
  4. Build fails because of missing references.

Running the build.cmd works to build, and puts the referenced .dlls in the correct place for the solution, and then it builds. I have seen different strategies on how these references are being done in the other NServiceKit projects.

Anyway, the other projects can generally be built (with VS2010 at least) without doing any init script to copy .dlls in place, so I don't think this desired behavior.

ZADD with multiple values/scores

I propose exposing a method that allows a batch ZADD:

ZADD key score1 value1 score2 value2 score3 value3 ...

master...yurigorokhov:master

Does this seem like a good API addition? If so I will make a pull request.

From my testing this method is much, much faster than the pipelined AddRangeToSortedSet command.

Latest Version instance issue

Hi team,
After updating latest version i am getting below exception please help us

Method 'ZUnionStoreWithWeights' in type 'NServiceKit.Redis.RedisNativeClient' from assembly 'NServiceKit.Redis, Version=1.0.20.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

I Get this error when I try to use this lib

Método ZUnionStoreWithWeights no tipo NServiceKit.Redis.RedisNativeClient do assembly NServiceKit.Redis, Version=1.0.20.0, Culture=neutral, PublicKeyToken=null não tem uma implementação

TypeLoadException ScanKeys

I Have this error:

Method 'ScanKeys' in type 'NServiceKit.Redis.RedisClient' from assembly 'NServiceKit.Redis, Version=1.0.14.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

Any clue ??

some problem in Get<T>(string key)

when we used the last vision,and in .net 4.0
there are some mistake in here
our log :
The offset and length went beyond the bounds of an array Or count is greater than the number of elements from index to source collection the end

System.ArraySegment`1..ctor(T[] array, Int32 offset, Int32 count)
NServiceKit.Redis.RedisNativeClient.WriteToSendBuffer(Byte[] cmdBytes)

NServiceKit.Redis.RedisNativeClient.WriteAllToSendBuffer(Byte[][] cmdWithBinaryArgs)
NServiceKit.Redis.RedisNativeClient.SendCommand(Byte[][] cmdWithBinaryArgs)
NServiceKit.Redis.RedisNativeClient.SendExpectData(Byte[][] cmdWithBinaryArgs)
NServiceKit.Redis.RedisClient.Get[T](String key)

PooledRedisClientManager holds on to closed sockets and doesn't recover

When using the PooledRedisClientManager, if Redis dies or becomes unavailable, the sockets in the socket pool get closed, and are never refreshed. Effectively leaving the SocketPool completely drained.
If a socket gets closed, there should be a mechanism for creating fresh sockets, should connectivity to Redis come back up.

RedisClient runtime error with latest .40 NServiceKit.Common

Hi guys, if you upgrade to the latest common package you have the following problem in runtime execution.

Unhandled Exception: System.TypeLoadException: Method 'AddRangeToSortedSetWithScores' in type 'NServiceKit.Redis.RedisClient' from assembly 'NServiceKit.Redis, Version=1.0.18.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
at POC.Redis.Program.Main(String[] args)

Regards.

Why RedisClient is incomplete ?

hi,

I liked to use the "RemoveByPattern" method RedisClient class.
Unfortunately, it is not avaialble.
Do you intend to update the class soon?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.