~ubuntu-branches/ubuntu/trusty/smuxi/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/ServiceStack/src/ServiceStack.Interfaces/Redis/Generic/IRedisTypedClient.cs

  • Committer: Package Import Robot
  • Author(s): Mirco Bauer
  • Date: 2013-05-25 22:11:31 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20130525221131-nd2mc0kzubuwyx20
Tags: 0.8.11-1
* [22d13d5] Imported Upstream version 0.8.11
* [6d2b95a] Refreshed patches
* [89eb66e] Added ServiceStack libraries to smuxi-engine package
* [848ab10] Enable Campfire engine
* [c6dbdc7] Always build db4o for predictable build result
* [13ec489] Exclude OS X specific libraries from dh_clideps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// https://github.com/mythz/ServiceStack.Redis
 
3
// ServiceStack.Redis: ECMA CLI Binding to the Redis key-value storage system
 
4
//
 
5
// Authors:
 
6
//   Demis Bellot (demis.bellot@gmail.com)
 
7
//
 
8
// Copyright 2010 Liquidbit Ltd.
 
9
//
 
10
// Licensed under the same terms of Redis and ServiceStack: new BSD license.
 
11
//
 
12
 
 
13
using System;
 
14
using System.Collections.Generic;
 
15
using ServiceStack.DataAccess;
 
16
using ServiceStack.DesignPatterns.Model;
 
17
 
 
18
namespace ServiceStack.Redis.Generic
 
19
{
 
20
        public interface IRedisTypedClient<T>
 
21
                : IBasicPersistenceProvider<T>
 
22
        {
 
23
                IHasNamed<IRedisList<T>> Lists { get; set; }
 
24
                IHasNamed<IRedisSet<T>> Sets { get; set; }
 
25
                IHasNamed<IRedisSortedSet<T>> SortedSets { get; set; }
 
26
                IRedisHash<TKey, T> GetHash<TKey>(string hashId);
 
27
 
 
28
                IRedisTypedTransaction<T> CreateTransaction();
 
29
        IRedisTypedPipeline<T> CreatePipeline();
 
30
 
 
31
        IRedisClient RedisClient { get; }
 
32
                
 
33
                IDisposable AcquireLock();
 
34
                IDisposable AcquireLock(TimeSpan timeOut);
 
35
 
 
36
                int Db { get; set; }
 
37
                List<string> GetAllKeys();
 
38
                IRedisSet TypeIdsSet { get; }
 
39
 
 
40
                T this[string key] { get; set; }
 
41
 
 
42
                string SequenceKey { get; set; }
 
43
                void SetSequence(int value);
 
44
                long GetNextSequence();
 
45
                long GetNextSequence(int incrBy);
 
46
                RedisKeyType GetEntryType(string key);
 
47
                string GetRandomKey();
 
48
 
 
49
                void SetEntry(string key, T value);
 
50
                void SetEntry(string key, T value, TimeSpan expireIn);
 
51
                bool SetEntryIfNotExists(string key, T value);
 
52
                T GetValue(string key);
 
53
                T GetAndSetValue(string key, T value);
 
54
                bool ContainsKey(string key);
 
55
                bool RemoveEntry(string key);
 
56
                bool RemoveEntry(params string[] args);
 
57
                bool RemoveEntry(params IHasStringId[] entities);
 
58
                long IncrementValue(string key);
 
59
                long IncrementValueBy(string key, int count);
 
60
                long DecrementValue(string key);
 
61
                long DecrementValueBy(string key, int count);
 
62
 
 
63
                bool ExpireIn(object id, TimeSpan expiresAt);
 
64
                bool ExpireAt(object id, DateTime dateTime);
 
65
                bool ExpireEntryIn(string key, TimeSpan expiresAt);
 
66
                bool ExpireEntryAt(string key, DateTime dateTime);
 
67
 
 
68
                TimeSpan GetTimeToLive(string key);
 
69
                void Save();
 
70
                void SaveAsync();
 
71
                void FlushDb();
 
72
                void FlushAll();
 
73
                T[] SearchKeys(string pattern);
 
74
                List<T> GetValues(List<string> keys);
 
75
                List<T> GetSortedEntryValues(IRedisSet<T> fromSet, int startingFrom, int endingAt);
 
76
 
 
77
            void StoreAsHash(T entity);
 
78
            T GetFromHash(object id);
 
79
 
 
80
                //Set operations
 
81
                HashSet<T> GetAllItemsFromSet(IRedisSet<T> fromSet);
 
82
                void AddItemToSet(IRedisSet<T> toSet, T item);
 
83
                void RemoveItemFromSet(IRedisSet<T> fromSet, T item);
 
84
                T PopItemFromSet(IRedisSet<T> fromSet);
 
85
                void MoveBetweenSets(IRedisSet<T> fromSet, IRedisSet<T> toSet, T item);
 
86
                int GetSetCount(IRedisSet<T> set);
 
87
                bool SetContainsItem(IRedisSet<T> set, T item);
 
88
                HashSet<T> GetIntersectFromSets(params IRedisSet<T>[] sets);
 
89
                void StoreIntersectFromSets(IRedisSet<T> intoSet, params IRedisSet<T>[] sets);
 
90
                HashSet<T> GetUnionFromSets(params IRedisSet<T>[] sets);
 
91
                void StoreUnionFromSets(IRedisSet<T> intoSet, params IRedisSet<T>[] sets);
 
92
                HashSet<T> GetDifferencesFromSet(IRedisSet<T> fromSet, params IRedisSet<T>[] withSets);
 
93
                void StoreDifferencesFromSet(IRedisSet<T> intoSet, IRedisSet<T> fromSet, params IRedisSet<T>[] withSets);
 
94
                T GetRandomItemFromSet(IRedisSet<T> fromSet);
 
95
 
 
96
                //List operations
 
97
                List<T> GetAllItemsFromList(IRedisList<T> fromList);
 
98
                List<T> GetRangeFromList(IRedisList<T> fromList, int startingFrom, int endingAt);
 
99
                List<T> SortList(IRedisList<T> fromList, int startingFrom, int endingAt);
 
100
                void AddItemToList(IRedisList<T> fromList, T value);
 
101
                void PrependItemToList(IRedisList<T> fromList, T value);
 
102
                T RemoveStartFromList(IRedisList<T> fromList);
 
103
                T BlockingRemoveStartFromList(IRedisList<T> fromList, TimeSpan? timeOut);
 
104
                T RemoveEndFromList(IRedisList<T> fromList);
 
105
                void RemoveAllFromList(IRedisList<T> fromList);
 
106
                void TrimList(IRedisList<T> fromList, int keepStartingFrom, int keepEndingAt);
 
107
                int RemoveItemFromList(IRedisList<T> fromList, T value);
 
108
                int RemoveItemFromList(IRedisList<T> fromList, T value, int noOfMatches);
 
109
                int GetListCount(IRedisList<T> fromList);
 
110
                T GetItemFromList(IRedisList<T> fromList, int listIndex);
 
111
                void SetItemInList(IRedisList<T> toList, int listIndex, T value);
 
112
 
 
113
                //Queue operations
 
114
                void EnqueueItemOnList(IRedisList<T> fromList, T item);
 
115
                T DequeueItemFromList(IRedisList<T> fromList);
 
116
                T BlockingDequeueItemFromList(IRedisList<T> fromList, TimeSpan? timeOut);
 
117
                
 
118
                //Stack operations
 
119
                void PushItemToList(IRedisList<T> fromList, T item);
 
120
                T PopItemFromList(IRedisList<T> fromList);
 
121
                T BlockingPopItemFromList(IRedisList<T> fromList, TimeSpan? timeOut);
 
122
                T PopAndPushItemBetweenLists(IRedisList<T> fromList, IRedisList<T> toList);
 
123
 
 
124
                //Sorted Set operations
 
125
                void AddItemToSortedSet(IRedisSortedSet<T> toSet, T value);
 
126
                void AddItemToSortedSet(IRedisSortedSet<T> toSet, T value, double score);
 
127
                bool RemoveItemFromSortedSet(IRedisSortedSet<T> fromSet, T value);
 
128
                T PopItemWithLowestScoreFromSortedSet(IRedisSortedSet<T> fromSet);
 
129
                T PopItemWithHighestScoreFromSortedSet(IRedisSortedSet<T> fromSet);
 
130
                bool SortedSetContainsItem(IRedisSortedSet<T> set, T value);
 
131
                double IncrementItemInSortedSet(IRedisSortedSet<T> set, T value, double incrementBy);
 
132
                int GetItemIndexInSortedSet(IRedisSortedSet<T> set, T value);
 
133
                int GetItemIndexInSortedSetDesc(IRedisSortedSet<T> set, T value);
 
134
                List<T> GetAllItemsFromSortedSet(IRedisSortedSet<T> set);
 
135
                List<T> GetAllItemsFromSortedSetDesc(IRedisSortedSet<T> set);
 
136
                List<T> GetRangeFromSortedSet(IRedisSortedSet<T> set, int fromRank, int toRank);
 
137
                List<T> GetRangeFromSortedSetDesc(IRedisSortedSet<T> set, int fromRank, int toRank);
 
138
                IDictionary<T, double> GetAllWithScoresFromSortedSet(IRedisSortedSet<T> set);
 
139
                IDictionary<T, double> GetRangeWithScoresFromSortedSet(IRedisSortedSet<T> set, int fromRank, int toRank);
 
140
                IDictionary<T, double> GetRangeWithScoresFromSortedSetDesc(IRedisSortedSet<T> set, int fromRank, int toRank);
 
141
                List<T> GetRangeFromSortedSetByLowestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore);
 
142
                List<T> GetRangeFromSortedSetByLowestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore, int? skip, int? take);
 
143
                List<T> GetRangeFromSortedSetByLowestScore(IRedisSortedSet<T> set, double fromScore, double toScore);
 
144
                List<T> GetRangeFromSortedSetByLowestScore(IRedisSortedSet<T> set, double fromScore, double toScore, int? skip, int? take);
 
145
                IDictionary<T, double> GetRangeWithScoresFromSortedSetByLowestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore);
 
146
                IDictionary<T, double> GetRangeWithScoresFromSortedSetByLowestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore, int? skip, int? take);
 
147
                IDictionary<T, double> GetRangeWithScoresFromSortedSetByLowestScore(IRedisSortedSet<T> set, double fromScore, double toScore);
 
148
                IDictionary<T, double> GetRangeWithScoresFromSortedSetByLowestScore(IRedisSortedSet<T> set, double fromScore, double toScore, int? skip, int? take);
 
149
                List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore);
 
150
                List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore, int? skip, int? take);
 
151
                List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, double fromScore, double toScore);
 
152
                List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, double fromScore, double toScore, int? skip, int? take);
 
153
                IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore);
 
154
                IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore, int? skip, int? take);
 
155
                IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRedisSortedSet<T> set, double fromScore, double toScore);
 
156
                IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRedisSortedSet<T> set, double fromScore, double toScore, int? skip, int? take);
 
157
                int RemoveRangeFromSortedSet(IRedisSortedSet<T> set, int minRank, int maxRank);
 
158
                int RemoveRangeFromSortedSetByScore(IRedisSortedSet<T> set, double fromScore, double toScore);
 
159
                int GetSortedSetCount(IRedisSortedSet<T> set);
 
160
                double GetItemScoreInSortedSet(IRedisSortedSet<T> set, T value);
 
161
                int StoreIntersectFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds);
 
162
                int StoreUnionFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds);
 
163
                
 
164
                //Hash operations
 
165
                bool HashContainsEntry<TKey>(IRedisHash<TKey, T> hash, TKey key);
 
166
                bool SetEntryInHash<TKey>(IRedisHash<TKey, T> hash, TKey key, T value);
 
167
                bool SetEntryInHashIfNotExists<TKey>(IRedisHash<TKey, T> hash, TKey key, T value);
 
168
                void SetRangeInHash<TKey>(IRedisHash<TKey, T> hash, IEnumerable<KeyValuePair<TKey, T>> keyValuePairs);
 
169
                T GetValueFromHash<TKey>(IRedisHash<TKey, T> hash, TKey key);
 
170
                bool RemoveEntryFromHash<TKey>(IRedisHash<TKey, T> hash, TKey key);
 
171
                int GetHashCount<TKey>(IRedisHash<TKey, T> hash);
 
172
                List<TKey> GetHashKeys<TKey>(IRedisHash<TKey, T> hash);
 
173
                List<T> GetHashValues<TKey>(IRedisHash<TKey, T> hash);
 
174
                Dictionary<TKey, T> GetAllEntriesFromHash<TKey>(IRedisHash<TKey, T> hash);
 
175
 
 
176
                //Useful common app-logic 
 
177
                void StoreRelatedEntities<TChild>(object parentId, List<TChild> children);
 
178
                void StoreRelatedEntities<TChild>(object parentId, params TChild[] children);
 
179
                void DeleteRelatedEntities<TChild>(object parentId);
 
180
                void DeleteRelatedEntity<TChild>(object parentId, object childId);
 
181
                List<TChild> GetRelatedEntities<TChild>(object parentId);
 
182
                int GetRelatedEntitiesCount<TChild>(object parentId);
 
183
                void AddToRecentsList(T value);
 
184
                List<T> GetLatestFromRecentsList(int skip, int take);
 
185
                List<T> GetEarliestFromRecentsList(int skip, int take);
 
186
        }
 
187
 
 
188
}
 
 
b'\\ No newline at end of file'