我想将Redis用作数据库,而不是缓存.根据我的(有限)理解,Redis是一个内存数据存储区.使用Redis有什么风险,我该如何减轻它们?
我正在尝试将自定义ContentProvider显示在数据和同步下,并且我遇到了一些问题.也就是说,它没有出现.
具体内容:
我的AndroidManifest.xml有提供者和服务:
<provider android:name="BooksProvider"
android:label="ClientName Books"
android:authorities="com.clientname.reader.books"
android:enabled="true"
android:exported="true"
android:syncable="true">
<grant-uri-permission android:pathPattern=".*" />
</provider>
<service android:name=".sync.SyncService"
android:exported="true" android:process=":sync">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.content.SyncAdapater"
android:resource="@xml/syncadapter" />
</service>
Run Code Online (Sandbox Code Playgroud)
res/xml/syncadapter.xml具有以下内容:
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.clientname.reader.books"
android:accountType="com.google"
android:supportsUploading="true"
android:userVisible="true"
/>
Run Code Online (Sandbox Code Playgroud)
为了安全起见,我甚至在onCreate上打了以下电话:
AccountManager accountManager = AccountManager.get(getApplicationContext());
Account[] accounts = accountManager.getAccountsByType("com.google");
for(Account account : accounts){
Log.d(TAG, "Account: " + account.name);
ContentResolver.setIsSyncable(account, Reader.AUTHORITY, 1);
}
Run Code Online (Sandbox Code Playgroud)
当我加载Activity时,我从ContentResolver.setIsSyncable获取adb日志,说该帐户已经设置为可同步,因此该方法没有做任何事情.
但是,提供商拒绝显示在"设置">"帐户和同步">"数据和同步"中.有什么想法吗?任何人都知道如何确定该部分中出现的内容?
[edit]更多信息:
花了几个小时调试后,我遇到了这个错误:
04-11 10:46:02.370: DEBUG/SyncManager(105): can't find a sync adapter for SyncAdapterType Key {name=com.clientname.reader.books, …Run Code Online (Sandbox Code Playgroud) 我正在Go中本地创建一个Pastry版本.从设计 [PDF]:
假设应用程序提供允许每个Pastry节点确定具有给定IP地址的节点与其自身的"距离"的功能.假设具有较低距离值的节点是更期望的.应用程序应根据其选择的邻近度量,使用traceroute或Internet子网映射等网络服务以及适当的缓存和近似技术来实现此功能,以最大限度地减少开销.
我试图找出从Go以编程方式确定两个EC2实例之间的"接近度"(即网络延迟)的最佳方法.不幸的是,我对低级网络不够熟悉,无法区分我可以使用的不同类型的请求.谷歌搜索没有提出任何测量来自Go的延迟的建议,一般的延迟技术似乎总是Linux二进制文件,我希望以更少的依赖关系的名义避免.有帮助吗?
另外,我注意到两个EC2实例之间的延迟应该是1ms.虽然我计划在EC2上使用该实现,但它可以假设在任何地方使用.延迟通常是如此糟糕,以至于我应该花费精力来确保两个节点的网络接近度?请记住,大多数Pastry请求可以在群集中服务器数量的日志库16中提供(因此,对于10,000个服务器,平均需要大约3个请求才能找到要搜索的密钥).例如,从EC2的亚太地区到EC2的美国东部地区的延迟是否足以证明在添加节点时增加的复杂性和延迟检查引入的开销?