Skip to content

Commit

Permalink
Merge pull request ServiceStack#150 from HookedMediaGroup/long_conver…
Browse files Browse the repository at this point in the history
…sion

Long conversion
  • Loading branch information
mythz committed May 25, 2013
2 parents 6cdbf5f + cc086a9 commit 0bee8be
Show file tree
Hide file tree
Showing 36 changed files with 194 additions and 197 deletions.
Binary file modified lib/ServiceStack.Common.dll
Binary file not shown.
Binary file modified lib/ServiceStack.Interfaces.dll
Binary file not shown.
Binary file modified lib/ServiceStack.Text.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/BasicRedisClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public partial class BasicRedisClientManager

public IRedisClientFactory RedisClientFactory { get; set; }

public int Db { get; private set; }
public long Db { get; private set; }

public Action<IRedisNativeClient> ConnectionFilter { get; set; }

Expand Down Expand Up @@ -65,7 +65,7 @@ public BasicRedisClientManager(
public BasicRedisClientManager(
IEnumerable<string> readWriteHosts,
IEnumerable<string> readOnlyHosts,
int initalDb)
long initalDb)
{
this.Db = initalDb;

Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/Generic/ManagedListGeneric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private List<T> GetRedisList()
return client.Lists[key].ToList();
}
}
public int IndexOf(T item)
public int IndexOf(T item)
{
return GetRedisList().IndexOf(item);
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public void CopyTo(T[] array, int arrayIndex)
GetRedisList().CopyTo(array, arrayIndex);
}

public int Count
public int Count
{
get { return GetRedisList().Count(); }
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisClientHash.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public bool Remove(KeyValuePair<TKey, T> item)

public int Count
{
get { return client.GetHashCount(this); }
get { return (int)client.GetHashCount(this); }
}

public bool IsReadOnly
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceStack.Redis/Generic/RedisClientList.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public int Count
{
get
{
return client.GetListCount(this);
return (int)client.GetListCount(this);
}
}

Expand Down Expand Up @@ -167,12 +167,12 @@ public void Trim(int keepStartingFrom, int keepEndingAt)
client.TrimList(this, keepStartingFrom, keepEndingAt);
}

public int RemoveValue(T value)
public long RemoveValue(T value)
{
return client.RemoveItemFromList(this, value);
}

public int RemoveValue(T value, int noOfMatches)
public long RemoveValue(T value, int noOfMatches)
{
return client.RemoveItemFromList(this, value, noOfMatches);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisClientSet.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public int Count
{
get
{
var setCount = client.GetSetCount(this);
var setCount = (int)client.GetSetCount(this);
return setCount;
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/ServiceStack.Redis/Generic/RedisClientSortedSet.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public int Count
{
get
{
var setCount = client.GetSortedSetCount(this);
var setCount = (int)client.GetSortedSetCount(this);
return setCount;
}
}
Expand All @@ -124,10 +124,10 @@ public double IncrementItem(T item, double incrementBy)

public int IndexOf(T item)
{
return client.GetItemIndexInSortedSet(this, item);
return (int)client.GetItemIndexInSortedSet(this, item);
}

public int IndexOfDescending(T item)
public long IndexOfDescending(T item)
{
return client.GetItemIndexInSortedSetDesc(this, item);
}
Expand Down Expand Up @@ -167,12 +167,12 @@ public List<T> GetRangeByHighestScore(double fromScore, double toScore, int? ski
return client.GetRangeFromSortedSetByHighestScore(this, fromScore, toScore, skip, take);
}

public int RemoveRange(int minRank, int maxRank)
public long RemoveRange(int minRank, int maxRank)
{
return client.RemoveRangeFromSortedSet(this, minRank, maxRank);
}

public int RemoveRangeByScore(double fromScore, double toScore)
public long RemoveRangeByScore(double fromScore, double toScore)
{
return client.RemoveRangeFromSortedSetByScore(this, fromScore, toScore);
}
Expand All @@ -182,12 +182,12 @@ public double GetItemScore(T item)
return client.GetItemScoreInSortedSet(this, item);
}

public int PopulateWithIntersectOf(params IRedisSortedSet<T>[] setIds)
public long PopulateWithIntersectOf(params IRedisSortedSet<T>[] setIds)
{
return client.StoreIntersectFromSortedSets(this, setIds);
}

public int PopulateWithUnionOf(params IRedisSortedSet<T>[] setIds)
public long PopulateWithUnionOf(params IRedisSortedSet<T>[] setIds)
{
return client.StoreUnionFromSortedSets(this, setIds);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisTypedClient_App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public List<TChild> GetRelatedEntities<TChild>(object parentId)
}
}

public int GetRelatedEntitiesCount<TChild>(object parentId)
public long GetRelatedEntitiesCount<TChild>(object parentId)
{
var childRefKey = GetChildReferenceSetKey<TChild>(parentId);
return client.GetSetCount(childRefKey);
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisTypedClient_Hash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public bool RemoveEntryFromHash<TKey>(IRedisHash<TKey, T> hash, TKey key)
return client.RemoveEntryFromHash(hash.Id, key.SerializeToString());
}

public int GetHashCount<TKey>(IRedisHash<TKey, T> hash)
public long GetHashCount<TKey>(IRedisHash<TKey, T> hash)
{
return client.GetHashCount(hash.Id);
}
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceStack.Redis/Generic/RedisTypedClient_List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,18 @@ public void TrimList(IRedisList<T> fromList, int keepStartingFrom, int keepEndin
client.LTrim(fromList.Id, keepStartingFrom, keepEndingAt);
}

public int RemoveItemFromList(IRedisList<T> fromList, T value)
public long RemoveItemFromList(IRedisList<T> fromList, T value)
{
const int removeAll = 0;
return client.LRem(fromList.Id, removeAll, SerializeValue(value));
}

public int RemoveItemFromList(IRedisList<T> fromList, T value, int noOfMatches)
public long RemoveItemFromList(IRedisList<T> fromList, T value, int noOfMatches)
{
return client.LRem(fromList.Id, noOfMatches, SerializeValue(value));
}

public int GetListCount(IRedisList<T> fromList)
public long GetListCount(IRedisList<T> fromList)
{
return client.LLen(fromList.Id);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/Generic/RedisTypedClient_Set.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class RedisTypedClient<T>
{
public IHasNamed<IRedisSet<T>> Sets { get; set; }

public int Db
public long Db
{
get { return client.Db; }
set { client.Db = value; }
Expand Down Expand Up @@ -95,7 +95,7 @@ public void MoveBetweenSets(IRedisSet<T> fromSet, IRedisSet<T> toSet, T item)
client.SMove(fromSet.Id, toSet.Id, SerializeValue(item));
}

public int GetSetCount(IRedisSet<T> set)
public long GetSetCount(IRedisSet<T> set)
{
return client.SCard(set.Id);
}
Expand Down
16 changes: 8 additions & 8 deletions src/ServiceStack.Redis/Generic/RedisTypedClient_SortedSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ public double IncrementItemInSortedSet(IRedisSortedSet<T> set, T value, double i
return client.IncrementItemInSortedSet(set.Id, value.SerializeToString(), incrementBy);
}

public int GetItemIndexInSortedSet(IRedisSortedSet<T> set, T value)
public long GetItemIndexInSortedSet(IRedisSortedSet<T> set, T value)
{
return client.GetItemIndexInSortedSet(set.Id, value.SerializeToString());
}

public int GetItemIndexInSortedSetDesc(IRedisSortedSet<T> set, T value)
public long GetItemIndexInSortedSetDesc(IRedisSortedSet<T> set, T value)
{
return client.GetItemIndexInSortedSetDesc(set.Id, value.SerializeToString());
}
Expand Down Expand Up @@ -250,17 +250,17 @@ public IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRed
return CreateGenericMap(map);
}

public int RemoveRangeFromSortedSet(IRedisSortedSet<T> set, int minRank, int maxRank)
public long RemoveRangeFromSortedSet(IRedisSortedSet<T> set, int minRank, int maxRank)
{
return client.RemoveRangeFromSortedSet(set.Id, minRank, maxRank);
}

public int RemoveRangeFromSortedSetByScore(IRedisSortedSet<T> set, double fromScore, double toScore)
public long RemoveRangeFromSortedSetByScore(IRedisSortedSet<T> set, double fromScore, double toScore)
{
return client.RemoveRangeFromSortedSetByScore(set.Id, fromScore, toScore);
}
public int GetSortedSetCount(IRedisSortedSet<T> set)

public long GetSortedSetCount(IRedisSortedSet<T> set)
{
return client.GetSortedSetCount(set.Id);
}
Expand All @@ -270,12 +270,12 @@ public double GetItemScoreInSortedSet(IRedisSortedSet<T> set, T value)
return client.GetItemScoreInSortedSet(set.Id, value.SerializeToString());
}

public int StoreIntersectFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds)
public long StoreIntersectFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds)
{
return client.StoreIntersectFromSortedSets(intoSetId.Id, setIds.ConvertAll(x => x.Id).ToArray());
}

public int StoreUnionFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds)
public long StoreUnionFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds)
{
return client.StoreUnionFromSortedSets(intoSetId.Id, setIds.ConvertAll(x => x.Id).ToArray());
}
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/Pipeline/RedisPipelineCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public void WriteCommand(params byte[][] cmdWithBinaryArgs)
cmdCount++;
}

public List<int> ReadAllAsInts()
public List<long> ReadAllAsInts()
{
var results = new List<int>();
var results = new List<long>();
while (cmdCount-- > 0)
{
results.Add(client.ReadInt());
Expand Down
8 changes: 4 additions & 4 deletions src/ServiceStack.Redis/PooledRedisClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public partial class PooledRedisClientManager

public IRedisClientFactory RedisClientFactory { get; set; }

public int Db { get; private set; }
public long Db { get; private set; }

public Action<IRedisNativeClient> ConnectionFilter { get; set; }

Expand All @@ -70,7 +70,7 @@ public PooledRedisClientManager(int poolSize, int poolTimeOutSeconds, params str
{
}

public PooledRedisClientManager(int initialDb, params string[] readWriteHosts)
public PooledRedisClientManager(long initialDb, params string[] readWriteHosts)
: this(readWriteHosts, readWriteHosts, initialDb) {}

public PooledRedisClientManager(params string[] readWriteHosts)
Expand Down Expand Up @@ -102,7 +102,7 @@ public PooledRedisClientManager(
public PooledRedisClientManager(
IEnumerable<string> readWriteHosts,
IEnumerable<string> readOnlyHosts,
int initalDb)
long initalDb)
: this(readWriteHosts, readOnlyHosts, null, initalDb, null, null)
{
}
Expand All @@ -111,7 +111,7 @@ public PooledRedisClientManager(
IEnumerable<string> readWriteHosts,
IEnumerable<string> readOnlyHosts,
RedisClientManagerConfig config,
int initalDb,
long initalDb,
int? poolSizeMultiplier,
int? poolTimeOutSeconds)
{
Expand Down
16 changes: 8 additions & 8 deletions src/ServiceStack.Redis/RedisClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public RedisClient(string host, int port)
Init();
}

public RedisClient(string host, int port, string password = null, int db = DefaultDb)
public RedisClient(string host, int port, string password = null, long db = DefaultDb)
: base(host, port, password, db)
{
Init();
Expand Down Expand Up @@ -122,7 +122,7 @@ public void SetEntry(string key, string value)
base.Set(key, bytesValue);
}

public void ChangeDb(int db)
public void ChangeDb(long db)
{
Db = db;
SendExpectSuccess(Commands.Select, db.ToUtf8Bytes());
Expand Down Expand Up @@ -236,7 +236,7 @@ public long DecrementValueBy(string key, int count)
return DecrBy(key, count);
}

public int AppendToValue(string key, string value)
public long AppendToValue(string key, string value)
{
return base.Append(key, value.ToUtf8Bytes());
}
Expand Down Expand Up @@ -409,7 +409,7 @@ public IRedisSubscription CreateSubscription()
return new RedisSubscription(this);
}

public int PublishMessage(string toChannel, string message)
public long PublishMessage(string toChannel, string message)
{
return base.Publish(toChannel, message.ToUtf8Bytes());
}
Expand Down Expand Up @@ -708,22 +708,22 @@ internal string UrnKey(Type type, object id)

#region LUA EVAL

public int ExecLuaAsInt(string body, params string[] args)
public long ExecLuaAsInt(string body, params string[] args)
{
return base.EvalInt(body, 0, args.ToMultiByteArray());
}

public int ExecLuaAsInt(string luaBody, string[] keys, string[] args)
public long ExecLuaAsInt(string luaBody, string[] keys, string[] args)
{
return base.EvalInt(luaBody, keys.Length, MergeAndConvertToBytes(keys, args));
}

public int ExecLuaShaAsInt(string sha1, params string[] args)
public long ExecLuaShaAsInt(string sha1, params string[] args)
{
return base.EvalShaInt(sha1, args.Length, args.ToMultiByteArray());
}

public int ExecLuaShaAsInt(string sha1, string[] keys, string[] args)
public long ExecLuaShaAsInt(string sha1, string[] keys, string[] args)
{
return base.EvalShaInt(sha1, keys.Length, MergeAndConvertToBytes(keys, args));
}
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/RedisClientHash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void AddRange(IEnumerable<KeyValuePair<string, string>> items)
client.SetRangeInHash(hashId, items);
}

public int IncrementValue(string key, int incrementBy)
public long IncrementValue(string key, int incrementBy)
{
return client.IncrementValueInHash(hashId, key, incrementBy);
}
Expand Down Expand Up @@ -97,7 +97,7 @@ public bool Remove(KeyValuePair<string, string> item)

public int Count
{
get { return client.GetHashCount(hashId); }
get { return (int)client.GetHashCount(hashId); }
}

public bool IsReadOnly
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceStack.Redis/RedisClientList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public int Count
{
get
{
return client.GetListCount(listId);
return (int)client.GetListCount(listId);
}
}

Expand Down Expand Up @@ -163,12 +163,12 @@ public void Trim(int keepStartingFrom, int keepEndingAt)
client.TrimList(listId, keepStartingFrom, keepEndingAt);
}

public int RemoveValue(string value)
public long RemoveValue(string value)
{
return client.RemoveItemFromList(listId, value);
}

public int RemoveValue(string value, int noOfMatches)
public long RemoveValue(string value, int noOfMatches)
{
return client.RemoveItemFromList(listId, value, noOfMatches);
}
Expand Down
Loading

0 comments on commit 0bee8be

Please sign in to comment.